From 9ac6bf79401a43d2876d2a4f977d63e56bb561e6 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Tue, 19 Sep 2023 16:46:44 -0400 Subject: [PATCH] Ajouter flags web.password et web.user --- config/config.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index c1f239a..be43f13 100644 --- a/config/config.go +++ b/config/config.go @@ -46,7 +46,9 @@ type WebConfig struct { Port int Protocol string } - Port int + 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 }