config pb
This commit is contained in:
parent
08100eb57f
commit
e3a7703bc5
@ -2,9 +2,7 @@ package mongo
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"cloud.o-forge.io/core/oc-lib/dbs"
|
"cloud.o-forge.io/core/oc-lib/dbs"
|
||||||
@ -41,21 +39,11 @@ type MongoDB struct {
|
|||||||
|
|
||||||
func (m *MongoDB) Init(collections []string, config MongoConf) {
|
func (m *MongoDB) Init(collections []string, config MongoConf) {
|
||||||
// var baseConfig string
|
// var baseConfig string
|
||||||
var err error
|
|
||||||
var conf map[string]string
|
|
||||||
m.Logger = logs.CreateLogger("oc-lib", "")
|
m.Logger = logs.CreateLogger("oc-lib", "")
|
||||||
ResourceMap = make(map[string]interface{})
|
ResourceMap = make(map[string]interface{})
|
||||||
|
|
||||||
logger := logs.CreateLogger("oclib", "")
|
logger := logs.CreateLogger("oclib", "")
|
||||||
|
|
||||||
db_conf, err := os.ReadFile("tests/oclib_conf.json")
|
|
||||||
if err != nil {
|
|
||||||
logger.Fatal().Msg("Could not find configuration file")
|
|
||||||
}
|
|
||||||
json.Unmarshal(db_conf, &conf)
|
|
||||||
|
|
||||||
logger.Info().Msg("Connecting to" + config.GetUrl())
|
logger.Info().Msg("Connecting to" + config.GetUrl())
|
||||||
|
|
||||||
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user