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
No related branches found
No related tags found
2 merge requests!25Resolve "read config toml",!18Develop
Pipeline #52043 passed
This commit is part of merge request !18. Comments created here will be created in the context of that merge request.
#example gosdn.toml
CliSocket="localhost:55055"
DatabaseSocket="localhost:7687"
DatabaseSocket="bolt://localhost:7687"
ConfigPath="./gosdn.toml"
\ No newline at end of file
......@@ -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)
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment