1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-10 09:52:51 +00:00
This commit is contained in:
2016-08-27 06:39:10 +00:00
parent be6cb39489
commit 4bcb240e97
8 changed files with 32 additions and 23 deletions

View File

@@ -27,7 +27,15 @@ func Configure(d DatabaseInfo) {
func (d *Driver) Connect() {
if (d.Info.URL != ""){
// Connect to MongoDB
s, err := mgo.DialWithTimeout(d.Info.URL, 5*time.Second)
database_info := &mgo.DialInfo{
Addrs: []string{d.Info.URL},
Database: d.Info.Database,
Timeout: 5*time.Second,
Username: d.Info.Username,
Password: d.Info.Password,
}
s, err := mgo.DialWithInfo(database_info)
if err != nil {
log.Println("MongoDB Driver Error", err)