Merge branch 'feature/bottin-api-host-flag' into main

This commit is contained in:
Victor Lacasse-Beaudoin 2023-09-16 18:12:47 -04:00
commit 573ac4f810

View file

@ -10,14 +10,21 @@ import (
) )
type Config struct { type Config struct {
API APIConfig API APIConfig
Web WebConfig Bottin BottinConfig
Web WebConfig
} }
type APIConfig struct { type APIConfig struct {
Port int Port int
} }
type BottinConfig struct {
API struct {
Host string
}
}
type WebConfig struct { type WebConfig struct {
Port int Port int
} }
@ -56,6 +63,12 @@ func RegisterFlags(cmd *cobra.Command) error {
return err return err
} }
// bottin.api.host
if err := RegisterString(cmd, true,
"bottin.api.host", "bottin-api-host", "Bottin API server host", "localhost"); err != nil {
return err
}
// web.port ; --web-port // web.port ; --web-port
cmd.PersistentFlags().Int("web-port", 3183, "Webserver port") cmd.PersistentFlags().Int("web-port", 3183, "Webserver port")
if err := viper.BindPFlag("web.port", cmd.PersistentFlags().Lookup("web-port")); err != nil { if err := viper.BindPFlag("web.port", cmd.PersistentFlags().Lookup("web-port")); err != nil {