cmd/ctrld: correct write default config condition when start

!76 was merged without rebasing on latest master, so it missed the
condition of "--cd" when checking for writing default config.
This commit is contained in:
Cuong Manh Le
2023-01-06 01:41:00 +07:00
committed by Cuong Manh Le
parent 8e91123dbf
commit 6edd42629e

View File

@@ -162,7 +162,9 @@ func initCLI() {
// WorkingDirectory is not supported on Windows.
cfg.WorkingDirectory = dir
// No config path, generating config in HOME directory.
if configPath == "" && !isNoConfigStart(cmd) && configBase64 == "" {
noConfigStart := isNoConfigStart(cmd) && cdUID != ""
writeDefaultConfig := !noConfigStart && configBase64 == "" && cdUID == ""
if configPath == "" && writeDefaultConfig {
defaultConfigFile = filepath.Join(dir, defaultConfigFile)
readConfigFile(true)
}