-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
37 lines (31 loc) · 911 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"github.com/titouanfreville/popcubeapi/api"
"github.com/titouanfreville/popcubeapi/configs"
"github.com/titouanfreville/popcubeapi/datastores"
)
var (
// DbConnectionInfo information to conect to DB
DbConnectionInfo = &configs.DbConnection{}
// APIServer api server configuration
APIServer = &configs.APIServerInfo{}
)
func getConf(dbSettings *configs.DbConnection, serverSetting *configs.APIServerInfo) {
*dbSettings, *serverSetting = configs.InitConfig()
}
func initAPI() {
api.StartAPI(APIServer.Hostname, APIServer.Port, DbConnectionInfo)
}
func initDatastore() {
user := DbConnectionInfo.User
db := DbConnectionInfo.Database
pass := DbConnectionInfo.Password
host := DbConnectionInfo.Host
port := DbConnectionInfo.Port
datastores.Store().InitDatabase(user, db, pass, host, port)
}
func main() {
getConf(DbConnectionInfo, APIServer)
initDatastore()
initAPI()
}