|
@@ -111,7 +111,18 @@ func bootstrapBroadcastState(config structs.SysConfig) (structs.AuthBroadcast, e
|
|
|
func UpdateBroadcastState(values map[string]interface{}) error {
|
|
func UpdateBroadcastState(values map[string]interface{}) error {
|
|
|
mu.Lock()
|
|
mu.Lock()
|
|
|
defer mu.Unlock()
|
|
defer mu.Unlock()
|
|
|
- return recursiveUpdate(reflect.ValueOf(&broadcastState).Elem(), reflect.ValueOf(values))
|
|
|
|
|
|
|
+ v := reflect.ValueOf(&broadcastState).Elem()
|
|
|
|
|
+ for key, value := range values {
|
|
|
|
|
+ field := v.FieldByName(key)
|
|
|
|
|
+ if !field.IsValid() || !field.CanSet() {
|
|
|
|
|
+ return fmt.Errorf("field %s does not exist or is not settable", key)
|
|
|
|
|
+ }
|
|
|
|
|
+ if err := recursiveUpdate(field, reflect.ValueOf(value)); err != nil {
|
|
|
|
|
+ return err
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ BroadcastToClients()
|
|
|
|
|
+ return nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// this allows us to insert stuff into nested vals and not overwrite the existing contents
|
|
// this allows us to insert stuff into nested vals and not overwrite the existing contents
|