1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-16 04:24:56 +02:00

internal/config/cli.go: move flags that are not bound to config to cmd/thalos/main.go

This commit is contained in:
Henrik Hautakoski 2024-02-18 17:40:04 +01:00
parent 69a36e016c
commit 53baae8a7f
2 changed files with 9 additions and 6 deletions

View file

@ -4,6 +4,7 @@ import (
"github.com/eosswedenorg/thalos/internal/config"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
var VersionString string = "dev"
@ -27,6 +28,14 @@ func init() {
`)
rootCmd.SetVersionTemplate(`{{with .Name}}{{printf "%s " .}}{{end}}{{printf "v%s" .Version}}` + "\n")
flags := pflag.FlagSet{}
flags.StringP("config", "c", "./config.yml", "Config file to read")
flags.StringP("level", "L", "info", "Log level to use")
flags.StringP("pid", "p", "", "Where to write process id")
flags.BoolP("no-state-cache", "n", false, "Force the application to take start block from config/api")
rootCmd.PersistentFlags().AddFlagSet(&flags)
rootCmd.PersistentFlags().AddFlagSet(config.GetFlags())
}

View file

@ -11,12 +11,6 @@ import (
func GetFlags() *pflag.FlagSet {
flags := pflag.FlagSet{}
// Cli only flags
flags.StringP("config", "c", "./config.yml", "Config file to read")
flags.StringP("level", "L", "info", "Log level to use")
flags.StringP("pid", "p", "", "Where to write process id")
flags.BoolP("no-state-cache", "n", false, "Force the application to take start block from config/api")
// Generic
flags.StringP("url", "u", "", "Url to antelope api")
flags.String("codec", "json", "Codec used to send messages")