From bc7b1cc6d8a79abe2423665d2585be9c8aaab375 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Mon, 29 Jul 2024 15:43:29 +0700 Subject: [PATCH] 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. --- cmd/cli/cli.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/cli/cli.go b/cmd/cli/cli.go index 7aae8b0..cebf054 100644 --- a/cmd/cli/cli.go +++ b/cmd/cli/cli.go @@ -1654,9 +1654,10 @@ func selfCheckStatus(s service.Service, homedir, sockDir string) (bool, service. } v = viper.NewWithOptions(viper.KeyDelimiter("::")) - ctrld.SetConfigNameWithPath(v, "ctrld", homedir) if configPath != "" { v.SetConfigFile(configPath) + } else { + v.SetConfigFile(defaultConfigFile) } if err := v.ReadInConfig(); err != nil { mainLog.Load().Error().Err(err).Msgf("failed to re-read configuration file: %s", v.ConfigFileUsed())