Ajouter flags web.password et web.user
This commit is contained in:
parent
acc8b010ad
commit
9ac6bf7940
1 changed files with 15 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
|
Reference in a new issue