Skip to content

Commit 1a3629b

Browse files
SLH335RocketRene
andcommitted
chore: use /etc/docker as default form config path
The config file creation form will now place the config file in '/etc/docker/cinder.json' by default, as the systemd service expects the file to be at that location. The path can be changed by also supplying the '-config' flag and setting it to the wanted path. Co-authored-by: René Kuhn <[email protected]>
1 parent 15364f7 commit 1a3629b

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

main.go

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,23 @@ func main() {
5555
flag.BoolVar(&createConfig, "createConfig", false, "Create config file interactively")
5656
flag.Parse()
5757

58-
if configFile == "" {
59-
configFile = "./cinder.json"
58+
log.SetFormatter(&log.TextFormatter{DisableTimestamp: true})
59+
log.SetOutput(os.Stdout)
60+
61+
if config.Quiet {
62+
log.SetLevel(log.ErrorLevel)
63+
}
64+
65+
if config.Debug {
66+
log.SetLevel(log.DebugLevel)
67+
log.Debug("Debug logging enabled")
6068
}
6169

6270
if createConfig {
71+
if configFile == "" {
72+
configFile = "/etc/docker/cinder.json"
73+
}
74+
6375
err := createConfiguration(configFile)
6476
if err == nil {
6577
log.Info("Configuration file written successfully")
@@ -71,8 +83,9 @@ func main() {
7183
os.Exit(0)
7284
}
7385

74-
log.SetFormatter(&log.TextFormatter{DisableTimestamp: true})
75-
log.SetOutput(os.Stdout)
86+
if configFile == "" {
87+
configFile = "./cinder.json"
88+
}
7689

7790
content, err := os.ReadFile(configFile)
7891
if err != nil {
@@ -88,16 +101,6 @@ func main() {
88101
log.Fatal("No mountDir configured. Abort.")
89102
}
90103

91-
if config.Quiet {
92-
log.SetLevel(log.ErrorLevel)
93-
}
94-
95-
if config.Debug {
96-
log.SetLevel(log.DebugLevel)
97-
}
98-
99-
log.Debug("Debug logging enabled")
100-
101104
if config.IdentityEndpoint == "" {
102105
log.Fatal("Identity endpoint missing")
103106
}

0 commit comments

Comments
 (0)