mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-18 04:40:03 +02:00
cmd/thalos/main.go: move cli flags to internal/config/cli.go as it is easier to write tests if we can get a hold of the flags.
This commit is contained in:
parent
117f1b50b4
commit
beb5b6cf04
3 changed files with 18 additions and 16 deletions
|
|
@ -6,6 +6,20 @@ import (
|
|||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
func GetFlags() *pflag.FlagSet {
|
||||
flags := pflag.FlagSet{}
|
||||
flags.StringP("config", "c", "./config.yml", "Config file to read")
|
||||
flags.StringP("level", "L", "info", "Log level to use")
|
||||
flags.StringP("log", "l", "", "Path to log file (default: print to stdout/stderr)")
|
||||
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")
|
||||
|
||||
flags.Int("start-block", 0, "Start to stream from this block (default: config value, cache, head from api)")
|
||||
flags.Int("end-block", 0, "Stop streaming when this block is reached")
|
||||
|
||||
return &flags
|
||||
}
|
||||
|
||||
func overrideCliFlags(cfg *Config, flags *pflag.FlagSet) error {
|
||||
logFile, _ := flags.GetString("log")
|
||||
if len(logFile) > 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue