mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
cmd/cli: notice users where config file is written/read
This commit is contained in:
committed by
Cuong Manh Le
parent
494d8be777
commit
4f125cf107
@@ -266,6 +266,9 @@ func initCLI() {
|
||||
{s.Uninstall, false},
|
||||
{s.Install, false},
|
||||
{s.Start, true},
|
||||
// Note that startCmd do not actually write ControlD config, but the config file was
|
||||
// generated after s.Start, so we notice users here for consistent with nextdns mode.
|
||||
{noticeWritingControlDConfig, false},
|
||||
}
|
||||
mainLog.Load().Notice().Msg("Starting service")
|
||||
if doTasks(tasks) {
|
||||
@@ -1042,6 +1045,7 @@ func readConfigFile(writeDefaultConfig bool) bool {
|
||||
// If err == nil, there's a config supplied via `--config`, no default config written.
|
||||
err := v.ReadInConfig()
|
||||
if err == nil {
|
||||
mainLog.Load().Notice().Msg("Reading config: " + v.ConfigFileUsed())
|
||||
mainLog.Load().Info().Msg("loading config file from: " + v.ConfigFileUsed())
|
||||
defaultConfigFile = v.ConfigFileUsed()
|
||||
return true
|
||||
@@ -1984,3 +1988,10 @@ func doGenerateNextDNSConfig(uid string) error {
|
||||
updateListenerConfig(&cfg)
|
||||
return writeConfigFile()
|
||||
}
|
||||
|
||||
func noticeWritingControlDConfig() error {
|
||||
if cdUID != "" {
|
||||
mainLog.Load().Notice().Msgf("Generating controld config: %s", defaultConfigFile)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user