fix initialize db connection

This commit is contained in:
andrey.savchuk committed 2018-04-30 19:43:38 +03:00
1 parent 7ffe48855f
commit 0bdedc65ad
2 files changed
+4 -7

No files matched your search

Generated
+2 -2
View File
@@ -191,7 +191,7 @@
"utils",
"validate"
]
revision = "ba4557a6c62685f3d95611dd6d84d1faaa8b38a5"
revision = "ac0827b7cb710a24b0fff817cbcab3b37539957e"
[[projects]]
branch = "master"
@@ -201,7 +201,7 @@
"blowfish",
"ssh/terminal"
]
revision = "b49d69b5da943f7ef3c9cf91c8777c1f78a0cc3c"
revision = "db7d12313a59cd5b727192a287195e2cdfa40049"
[[projects]]
branch = "master"
+2 -5
View File
@@ -16,9 +16,9 @@ import (
"github.com/asaskevich/govalidator"
"github.com/graarh/golang-socketio"
"encoding/json"
"gitlab8.alx/msp2.0/msp-lib/database"
"os/signal"
"net"
"gitlab8.alx/msp2.0/msp-lib/database"
)
var (
@@ -55,10 +55,6 @@ func init() {
logger.Warn("Remote config isn't received")
time.Sleep(time.Second * 5)
}
remoteConfig := config.GetRemote().(*conf.RemoteConfig)
validRemoteConfig(remoteConfig)
config.InitConfig(&conf.Configuration{})
database.InitDb(remoteConfig.Database)
}
func main() {
@@ -116,6 +112,7 @@ func subscribeSocket(client *gosocketio.Client, eventName string) {
remoteConfig := &conf.RemoteConfig{}
config.InitRemoteConfig(remoteConfig, args)
validRemoteConfig(remoteConfig)
database.InitDb(remoteConfig.Database)
backend.StopGrpcServer()
for !checkPortIsFree(remoteConfig.GrpcAddress.Port) {
time.Sleep(time.Second * 3)