Ajouter et implémenter cfg.Bottin.API.Port et cfg.Bottin.API.Protocol

This commit is contained in:
Victor Lacasse-Beaudoin 2023-09-16 18:21:39 -04:00
parent 9b6dd055ef
commit 532c85f200
2 changed files with 17 additions and 3 deletions

View file

@ -21,8 +21,10 @@ type APIConfig struct {
type BottinConfig struct {
API struct {
Host string
Key string
Host string
Key string
Port int
Protocol string
}
}
@ -76,6 +78,18 @@ func RegisterFlags(cmd *cobra.Command) error {
return err
}
// bottin.api.port
if err := RegisterInt(cmd, true,
"bottin.api.port", "bottin-api-port", "Bottin API server port", 1312); err != nil {
return err
}
// bottin.api.protocol
if err := RegisterString(cmd, true,
"bottin.api.protocol", "bottin-api-protocol", "Bottin API server protocol", "http"); 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 {