mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-18 04:40:03 +02:00
nternal/config/cli.go: move overrideCliFlags() to cmd/thalos/server.go as its pretty specific code.
This commit is contained in:
parent
53baae8a7f
commit
7f1f186aa0
4 changed files with 15 additions and 24 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
|
|
@ -204,10 +205,21 @@ func GetConfig(flags *pflag.FlagSet) (*config.Config, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
return config.NewBuilder().
|
||||
cfg, err := config.NewBuilder().
|
||||
SetConfigFile(filename).
|
||||
SetFlags(flags).
|
||||
Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
logFile, _ := flags.GetString("log")
|
||||
if len(logFile) > 0 {
|
||||
cfg.Log.Directory = path.Dir(logFile)
|
||||
cfg.Log.Filename = path.Base(logFile)
|
||||
}
|
||||
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
func serverCmd(cmd *cobra.Command, args []string) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue