make cli mode respect log.level (#2124)

Fixes #2119

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
Kristoffer Dalby 2024-09-11 10:43:22 +02:00 committed by GitHub
parent 7be8796d87
commit 4b02dc9565
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -732,6 +732,9 @@ func prefixV6() (*netip.Prefix, error) {
// LoadCLIConfig returns the needed configuration for the CLI client
// of Headscale to connect to a Headscale server.
func LoadCLIConfig() (*Config, error) {
logConfig := logConfig()
zerolog.SetGlobalLevel(logConfig.Level)
return &Config{
DisableUpdateCheck: viper.GetBool("disable_check_updates"),
UnixSocket: viper.GetString("unix_socket"),
@ -741,6 +744,7 @@ func LoadCLIConfig() (*Config, error) {
Timeout: viper.GetDuration("cli.timeout"),
Insecure: viper.GetBool("cli.insecure"),
},
Log: logConfig,
}, nil
}