Archived
2
0

added control protection.

This commit is contained in:
Miroslav Šedivý
2021-11-16 23:48:40 +01:00
parent 00201af40c
commit e2ba39922c
4 changed files with 54 additions and 0 deletions

View File

@ -10,6 +10,8 @@ type WebSocket struct {
AdminPassword string
Proxy bool
Locks []string
ControlProtection bool
}
func (WebSocket) Init(cmd *cobra.Command) error {
@ -33,6 +35,11 @@ func (WebSocket) Init(cmd *cobra.Command) error {
return err
}
cmd.PersistentFlags().Bool("control_protection", true, "control protection means, users can gain control only if at least one admin is in the room")
if err := viper.BindPFlag("control_protection", cmd.PersistentFlags().Lookup("control_protection")); err != nil {
return err
}
return nil
}
@ -41,4 +48,6 @@ func (s *WebSocket) Set() {
s.AdminPassword = viper.GetString("password_admin")
s.Proxy = viper.GetBool("proxy")
s.Locks = viper.GetStringSlice("locks")
s.ControlProtection = viper.GetBool("control_protection")
}