Add flag for only checking/creating the config file

This commit is contained in:
Melody Becker 2024-11-07 10:03:01 +01:00
parent 0e036b152b
commit ad68e97eaf
2 changed files with 11 additions and 0 deletions

View file

@ -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() {

View file

@ -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,