1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-17 04:30:03 +02:00

internal/config/cli.go: Rename Config.ReadCliFlags to ovverideCliFlags and make it a function instead of method.

This commit is contained in:
Henrik Hautakoski 2024-02-18 10:55:15 +01:00
parent b4c305d8ea
commit 7033240000
2 changed files with 2 additions and 3 deletions

View file

@ -93,7 +93,7 @@ func (b *Builder) Build() (*Config, error) {
// Call custom handler.
if b.flags != nil {
if err := conf.ReadCliFlags(b.flags); err != nil {
if err := overrideCliFlags(&conf, b.flags); err != nil {
return nil, err
}
}

View file

@ -6,8 +6,7 @@ import (
"github.com/spf13/pflag"
)
// Read cli flag values into the config
func (cfg *Config) ReadCliFlags(flags *pflag.FlagSet) error {
func overrideCliFlags(cfg *Config, flags *pflag.FlagSet) error {
logFile, _ := flags.GetString("log")
if len(logFile) > 0 {
cfg.Log.Directory = path.Dir(logFile)