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

controller config is read

parent d83c2f9f
No related branches found
No related tags found
2 merge requests!25Resolve "read config toml",!18Develop
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