@@ -49,6 +49,7 @@ type TemplateData struct {
4949
5050var requiredKeys = [3 ]string {"description" , "default" , "type" }
5151var deprecatedMap = make (map [string ][]string )
52+ var runtimeConfigurableMap = make (map [string ]bool )
5253
5354func GenParamEnum () {
5455 /*
@@ -153,7 +154,15 @@ func GenParamEnum() {
153154 deprecatedMap [entry ["name" ].(string )] = replacedBySlice
154155 }
155156
157+ // Handle runtime_configurable field
156158 rawName := entry ["name" ].(string )
159+ if runtimeConfigurable , ok := entry ["runtime_configurable" ].(bool ); ok {
160+ runtimeConfigurableMap [rawName ] = runtimeConfigurable
161+ } else {
162+ // Default to false if not specified
163+ runtimeConfigurableMap [rawName ] = false
164+ }
165+
157166 name := strings .ReplaceAll (rawName , "." , "_" )
158167 pType := entry ["type" ].(string )
159168 switch pType {
@@ -192,15 +201,16 @@ func GenParamEnum() {
192201
193202 // Generate the code based on the template
194203 err = packageTemplate .Execute (f , struct {
195- StringMap map [string ]string
196- StringSliceMap map [string ]string
197- IntMap map [string ]string
198- BoolMap map [string ]string
199- DurationMap map [string ]string
200- ObjectMap map [string ]string
201- DeprecatedMap map [string ][]string
202- AllParamNames []string
203- }{StringMap : stringParamMap , StringSliceMap : stringSliceParamMap , IntMap : intParamMap , BoolMap : boolParamMap , DurationMap : durationParamMap , ObjectMap : objectParamMap , DeprecatedMap : deprecatedMap , AllParamNames : allParamNames })
204+ StringMap map [string ]string
205+ StringSliceMap map [string ]string
206+ IntMap map [string ]string
207+ BoolMap map [string ]string
208+ DurationMap map [string ]string
209+ ObjectMap map [string ]string
210+ DeprecatedMap map [string ][]string
211+ RuntimeConfigurableMap map [string ]bool
212+ AllParamNames []string
213+ }{StringMap : stringParamMap , StringSliceMap : stringSliceParamMap , IntMap : intParamMap , BoolMap : boolParamMap , DurationMap : durationParamMap , ObjectMap : objectParamMap , DeprecatedMap : deprecatedMap , RuntimeConfigurableMap : runtimeConfigurableMap , AllParamNames : allParamNames })
204214
205215 if err != nil {
206216 panic (err )
@@ -476,6 +486,27 @@ func GetDeprecated() map[string][]string {
476486 }
477487}
478488
489+ // runtimeConfigurableMap is a map of parameter names to their runtime configurability status.
490+ // It is generated from docs/parameters.yaml and indicates whether a parameter can be reloaded
491+ // at runtime without requiring a server restart.
492+ var runtimeConfigurableMap = map[string]bool{
493+ {{- range $key, $value := .RuntimeConfigurableMap}}
494+ "{{$key}}": {{$value}},
495+ {{- end}}
496+ }
497+
498+ func GetRuntimeConfigurable() map[string]bool {
499+ return runtimeConfigurableMap
500+ }
501+
502+ // IsRuntimeConfigurable returns whether the given parameter name can be reloaded at runtime
503+ func IsRuntimeConfigurable(paramName string) bool {
504+ if val, ok := runtimeConfigurableMap[paramName]; ok {
505+ return val
506+ }
507+ return false
508+ }
509+
479510func (sP StringParam) GetString() string {
480511 config := getOrCreateConfig()
481512 switch sP.name {
@@ -495,6 +526,10 @@ func (sP StringParam) IsSet() bool {
495526 return viper.IsSet(sP.name)
496527}
497528
529+ func (sP StringParam) IsRuntimeConfigurable() bool {
530+ return IsRuntimeConfigurable(sP.name)
531+ }
532+
498533func (slP StringSliceParam) GetStringSlice() []string {
499534 config := getOrCreateConfig()
500535 switch slP.name {
@@ -514,6 +549,10 @@ func (slP StringSliceParam) IsSet() bool {
514549 return viper.IsSet(slP.name)
515550}
516551
552+ func (slP StringSliceParam) IsRuntimeConfigurable() bool {
553+ return IsRuntimeConfigurable(slP.name)
554+ }
555+
517556func (iP IntParam) GetInt() int {
518557 config := getOrCreateConfig()
519558 switch iP.name {
@@ -533,6 +572,10 @@ func (iP IntParam) IsSet() bool {
533572 return viper.IsSet(iP.name)
534573}
535574
575+ func (iP IntParam) IsRuntimeConfigurable() bool {
576+ return IsRuntimeConfigurable(iP.name)
577+ }
578+
536579func (bP BoolParam) GetBool() bool {
537580 config := getOrCreateConfig()
538581 switch bP.name {
@@ -552,6 +595,10 @@ func (bP BoolParam) IsSet() bool {
552595 return viper.IsSet(bP.name)
553596}
554597
598+ func (bP BoolParam) IsRuntimeConfigurable() bool {
599+ return IsRuntimeConfigurable(bP.name)
600+ }
601+
555602func (dP DurationParam) GetDuration() time.Duration {
556603 config := getOrCreateConfig()
557604 switch dP.name {
@@ -571,6 +618,10 @@ func (dP DurationParam) IsSet() bool {
571618 return viper.IsSet(dP.name)
572619}
573620
621+ func (dP DurationParam) IsRuntimeConfigurable() bool {
622+ return IsRuntimeConfigurable(dP.name)
623+ }
624+
574625func (oP ObjectParam) Unmarshal(rawVal any) error {
575626 return viper.UnmarshalKey(oP.name, rawVal)
576627}
@@ -583,6 +634,10 @@ func (oP ObjectParam) IsSet() bool {
583634 return viper.IsSet(oP.name)
584635}
585636
637+ func (oP ObjectParam) IsRuntimeConfigurable() bool {
638+ return IsRuntimeConfigurable(oP.name)
639+ }
640+
586641// allParameterNames is the list of all config keys generated from
587642// docs/parameters.yaml. It is primarily used to bind environment variables so
588643// that env-only overrides are included in viper.AllSettings().
0 commit comments