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 }