Ajouter flags web.password et web.user

This commit is contained in:
Victor Lacasse-Beaudoin 2023-09-19 16:46:44 -04:00
parent acc8b010ad
commit 9ac6bf7940

View file

@ -46,7 +46,9 @@ type WebConfig struct {
Port int
Protocol string
}
Password string
Port int
User string
}
func UnmarshalConfig() (cfg Config, err error) {
@ -184,11 +186,23 @@ func RegisterFlags(cmd *cobra.Command) error {
return err
}
// web.password ; --web-password
if err := RegisterString(cmd, true,
"web.password", "web-password", "Webserver basic auth password", "bottinag"); err != nil {
return err
}
// web.port ; --web-port
cmd.PersistentFlags().Int("web-port", 3183, "Webserver port")
if err := viper.BindPFlag("web.port", cmd.PersistentFlags().Lookup("web-port")); err != nil {
return err
}
// web.user ; --web-user
if err := RegisterString(cmd, true,
"web.user", "web-user", "Webserver basic auth username", "bottinag"); err != nil {
return err
}
return nil
}