mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-07-04 01:07:49 +02:00
cmd/cli: fix wrong config file reading during self-check
At the time self-check process running, we have already known the exact config file being used by ctrld service. Thus, we should just re-read this config file directly instead of guessing the config file.
This commit is contained in:
committed by
Cuong Manh Le
parent
ec684348ed
commit
bc7b1cc6d8
+2
-1
@@ -1654,9 +1654,10 @@ func selfCheckStatus(s service.Service, homedir, sockDir string) (bool, service.
|
|||||||
}
|
}
|
||||||
|
|
||||||
v = viper.NewWithOptions(viper.KeyDelimiter("::"))
|
v = viper.NewWithOptions(viper.KeyDelimiter("::"))
|
||||||
ctrld.SetConfigNameWithPath(v, "ctrld", homedir)
|
|
||||||
if configPath != "" {
|
if configPath != "" {
|
||||||
v.SetConfigFile(configPath)
|
v.SetConfigFile(configPath)
|
||||||
|
} else {
|
||||||
|
v.SetConfigFile(defaultConfigFile)
|
||||||
}
|
}
|
||||||
if err := v.ReadInConfig(); err != nil {
|
if err := v.ReadInConfig(); err != nil {
|
||||||
mainLog.Load().Error().Err(err).Msgf("failed to re-read configuration file: %s", v.ConfigFileUsed())
|
mainLog.Load().Error().Err(err).Msgf("failed to re-read configuration file: %s", v.ConfigFileUsed())
|
||||||
|
|||||||
Reference in New Issue
Block a user