Skip to content
Snippets Groups Projects
Commit 1cbd9445 authored by Manuel Kieweg's avatar Manuel Kieweg
Browse files

Merge branch '18-read-config-toml' into 'develop'

Resolve "read config toml"

See merge request cocsn/gosdn!25
parents 5304922e e8513d8e
Branches
Tags
2 merge requests!25Resolve "read config toml",!18Develop
Pipeline #52043 passed
#example gosdn.toml #example gosdn.toml
CliSocket="localhost:55055" CliSocket="localhost:55055"
DatabaseSocket="localhost:7687" DatabaseSocket="bolt://localhost:7687"
ConfigPath="./gosdn.toml" ConfigPath="./gosdn.toml"
\ No newline at end of file
...@@ -13,7 +13,7 @@ func main() { ...@@ -13,7 +13,7 @@ func main() {
configFileName := flag.String("config-file", "", "Path to the config file") configFileName := flag.String("config-file", "", "Path to the config file")
flag.Parse() flag.Parse()
cliSocket := *cliListenAddr + *cliListenPort cliSocket := *cliListenAddr + ":" + *cliListenPort
// hand off to cmd for further processing // hand off to cmd for further processing
nucleus.StartUp(cliSocket, *configFileName) nucleus.StartUp(cliSocket, *configFileName)
......
...@@ -8,13 +8,6 @@ import ( ...@@ -8,13 +8,6 @@ import (
"os" "os"
) )
/*
#example gosdn.toml
CliSocket="localhost:55055"
DatabaseSocket="localhost:7687"
ConfigPath="./gosdn.toml"
*/
type controllerConfig struct { type controllerConfig struct {
CliSocket string CliSocket string
DatabaseSocket string DatabaseSocket string
...@@ -30,7 +23,7 @@ type Core struct { ...@@ -30,7 +23,7 @@ type Core struct {
config controllerConfig config controllerConfig
} }
func (c Core) Init(socket, configfile string) { func (c *Core) Init(socket, configfile string) {
if configfile == "" { if configfile == "" {
configfile = "gosdn.toml" configfile = "gosdn.toml"
} }
...@@ -53,7 +46,7 @@ func (c Core) Init(socket, configfile string) { ...@@ -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) 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) f, err := os.Create(c.config.ConfigPath)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment