Add flag for only checking/creating the config file
This commit is contained in:
parent
0e036b152b
commit
ad68e97eaf
2 changed files with 11 additions and 0 deletions
5
flags.go
5
flags.go
|
@ -18,6 +18,11 @@ var (
|
||||||
"Info",
|
"Info",
|
||||||
"Set the logging level. Options are: Trace, Debug, Info, Warning, Error, Fatal. Capitalisation doesn't matter. Defaults to Info",
|
"Set the logging level. Options are: Trace, Debug, Info, Warning, Error, Fatal. Capitalisation doesn't matter. Defaults to Info",
|
||||||
)
|
)
|
||||||
|
flagConfigOnly *bool = flag.Bool(
|
||||||
|
"validate-config",
|
||||||
|
false,
|
||||||
|
"If set, the server will only validate the config (or write the default one) and then quit",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
6
main.go
6
main.go
|
@ -39,6 +39,12 @@ func main() {
|
||||||
Str("config-file", *flagConfigFile).
|
Str("config-file", *flagConfigFile).
|
||||||
Msg("Failed to read config and couldn't write default")
|
Msg("Failed to read config and couldn't write default")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Request to only check config
|
||||||
|
if *flagConfigOnly {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
storageCache, err := cache.NewCache(
|
storageCache, err := cache.NewCache(
|
||||||
config.GlobalConfig.Storage.MaxInMemoryCacheSize,
|
config.GlobalConfig.Storage.MaxInMemoryCacheSize,
|
||||||
config.GlobalConfig.Storage.RedisUrl,
|
config.GlobalConfig.Storage.RedisUrl,
|
||||||
|
|
Loading…
Reference in a new issue