1
0
Fork 0
mirror of https://github.com/vbatts/imgsrv.git synced 2025-07-01 06:48:29 +00:00

*: fixes to be working on new abstractions

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2017-04-07 13:29:07 -04:00
parent b80d34f423
commit 610cd418ca
Signed by: vbatts
GPG key ID: 10937E57733F1362
3 changed files with 43 additions and 10 deletions

View file

@ -1,6 +1,7 @@
package mongo
import (
"encoding/json"
"strings"
"github.com/vbatts/imgsrv/dbutil"
@ -29,8 +30,15 @@ type mongoHandle struct {
Gfs *mgo.GridFS
}
func (h *mongoHandle) Init(config interface{}) (err error) {
h.config = config.(dbConfig)
func (h *mongoHandle) Init(config []byte, err error) error {
if err != nil {
return err
}
h.config = dbConfig{}
if err := json.Unmarshal(config, &h.config); err != nil {
return err
}
h.Session, err = mgo.Dial(h.config.Seed)
if err != nil {