From e8513d8e1fe34d22dcde17d2f1faf4898adc275b Mon Sep 17 00:00:00 2001 From: Manuel Kieweg <mail@manuelkieweg.de> Date: Fri, 25 Sep 2020 16:55:02 +0100 Subject: [PATCH] controller config is read --- gosdn.toml | 2 +- main.go | 2 +- nucleus/controller.go | 11 ++--------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/gosdn.toml b/gosdn.toml index 3c16579ad..38bf79e21 100644 --- a/gosdn.toml +++ b/gosdn.toml @@ -1,4 +1,4 @@ #example gosdn.toml CliSocket="localhost:55055" -DatabaseSocket="localhost:7687" +DatabaseSocket="bolt://localhost:7687" ConfigPath="./gosdn.toml" \ No newline at end of file diff --git a/main.go b/main.go index 712ed2f30..66836589d 100644 --- a/main.go +++ b/main.go @@ -13,7 +13,7 @@ func main() { configFileName := flag.String("config-file", "", "Path to the config file") flag.Parse() - cliSocket := *cliListenAddr + *cliListenPort + cliSocket := *cliListenAddr + ":" + *cliListenPort // hand off to cmd for further processing nucleus.StartUp(cliSocket, *configFileName) diff --git a/nucleus/controller.go b/nucleus/controller.go index 306e26899..fb36ba54c 100644 --- a/nucleus/controller.go +++ b/nucleus/controller.go @@ -8,13 +8,6 @@ import ( "os" ) -/* -#example gosdn.toml -CliSocket="localhost:55055" -DatabaseSocket="localhost:7687" -ConfigPath="./gosdn.toml" -*/ - type controllerConfig struct { CliSocket string DatabaseSocket string @@ -30,7 +23,7 @@ type Core struct { config controllerConfig } -func (c Core) Init(socket, configfile string) { +func (c *Core) Init(socket, configfile string) { if configfile == "" { configfile = "gosdn.toml" } @@ -53,7 +46,7 @@ func (c Core) Init(socket, configfile string) { c.database = database.NewDatabaseClient(c.config.DatabaseSocket, c.config.DatabaseUser, c.config.DatabasePassword, c.config.DatabaseCrypto) } -func (c Core) Shutdown() { +func (c *Core) Shutdown() { f, err := os.Create(c.config.ConfigPath) if err != nil { log.Fatal(err) -- GitLab