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
8d84398b
Commit
8d84398b
authored
4 years ago
by
Manuel Kieweg
Browse files
Options
Downloads
Patches
Plain Diff
changed config path and cleaned up config
parent
4bc929eb
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!90
Develop
Checking pipeline status
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/root.go
+4
-14
4 additions, 14 deletions
cmd/root.go
configs/gosdn.toml
+0
-4
0 additions, 4 deletions
configs/gosdn.toml
with
4 additions
and
18 deletions
cmd/root.go
+
4
−
14
View file @
8d84398b
...
...
@@ -33,12 +33,10 @@ package cmd
import
(
"code.fbi.h-da.de/cocsn/gosdn/cli"
"fmt"
"os"
"github.com/spf13/cobra"
"os"
homedir
"github.com/mitchellh/go-homedir"
"github.com/spf13/viper"
)
...
...
@@ -76,7 +74,7 @@ func init() {
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.
rootCmd
.
PersistentFlags
()
.
StringVar
(
&
cfgFile
,
"config"
,
""
,
"config file (default is
$HOME/.
gosdn.
ya
ml)"
)
rootCmd
.
PersistentFlags
()
.
StringVar
(
&
cfgFile
,
"config"
,
""
,
"config file (default is
./configs/
gosdn.
to
ml)"
)
// Cobra also supports local flags, which will only run
...
...
@@ -91,16 +89,8 @@ func initConfig() {
// Use config file from the flag.
viper
.
SetConfigFile
(
cfgFile
)
}
else
{
// Find home directory.
home
,
err
:=
homedir
.
Dir
()
if
err
!=
nil
{
fmt
.
Println
(
err
)
os
.
Exit
(
1
)
}
// Search config in home directory with name ".gosdn" (without extension).
viper
.
AddConfigPath
(
home
)
viper
.
SetConfigName
(
".gosdn"
)
viper
.
AddConfigPath
(
"./configs"
)
viper
.
SetConfigName
(
"gosdn"
)
}
viper
.
AutomaticEnv
()
// read in environment variables that match
...
...
This diff is collapsed.
Click to expand it.
configs/gosdn.toml
+
0
−
4
View file @
8d84398b
CliSocket
=
":55055"
db.socket
=
"bolt://172.17.0.4:7687"
db.user
=
""
db.password
=
""
db.crypto
=
false
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