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:
parent
b80d34f423
commit
610cd418ca
3 changed files with 43 additions and 10 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue