Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
goSDN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
goSDN
Commits
e8513d8e
Commit
e8513d8e
authored
4 years ago
by
Manuel Kieweg
Browse files
Options
Downloads
Patches
Plain Diff
controller config is read
parent
d83c2f9f
No related branches found
No related tags found
2 merge requests
!25
Resolve "read config toml"
,
!18
Develop
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gosdn.toml
+1
-1
1 addition, 1 deletion
gosdn.toml
main.go
+1
-1
1 addition, 1 deletion
main.go
nucleus/controller.go
+2
-9
2 additions, 9 deletions
nucleus/controller.go
with
4 additions
and
11 deletions
gosdn.toml
+
1
−
1
View file @
e8513d8e
#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
This diff is collapsed.
Click to expand it.
main.go
+
1
−
1
View file @
e8513d8e
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
nucleus/controller.go
+
2
−
9
View file @
e8513d8e
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment