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