fix: config file paths consistency

This commit is contained in:
Mikaël Cluseau 2018-06-20 13:59:15 +11:00
parent b223bcd530
commit 748cb0945a

View File

@ -14,19 +14,21 @@ var (
)
func readConfig() (config *clustersconfig.Config, err error) {
configFile := filepath.Join(*dataDir, "current-config.yaml")
if *configFromDir != "" {
config, err = clustersconfig.FromDir(*dataDir)
config, err = clustersconfig.FromDir(*configFromDir)
if err != nil {
log.Print("failed to load config: ", err)
return nil, err
}
if err = config.SaveTo(filepath.Join(*dataDir, "global-config.yaml")); err != nil {
if err = config.SaveTo(configFile); err != nil {
return nil, err
}
return
}
return clustersconfig.FromFile(filepath.Join(*dataDir, "current-config.yaml"))
return clustersconfig.FromFile(configFile)
}