Skip to content

Commit

Permalink
Add helper function to list all dynamic config keys used in production
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaddoll committed Jul 2, 2022
1 parent e9915ae commit f84d560
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions common/dynamicconfig/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,30 @@ type (
}
)

// ListAllKeys returns all key used in production
func ListAllProductionKeys() []Key {
result := make([]Key, 0, len(IntKeys)+len(BoolKeys)+len(FloatKeys)+len(StringKeys)+len(DurationKeys)+len(MapKeys))
for i := TestGetIntPropertyFilteredByTaskListInfoKey + 1; i < UnknownIntKey; i++ {
result = append(result, i)
}
for i := TestGetBoolPropertyFilteredByTaskListInfoKey + 1; i < UnknownBoolKey; i++ {
result = append(result, i)
}
for i := TestGetFloat64PropertyKey + 1; i < UnknownFloatKey; i++ {
result = append(result, i)
}
for i := TestGetStringPropertyKey + 1; i < UnknownStringKey; i++ {
result = append(result, i)
}
for i := TestGetDurationPropertyFilteredByTaskListInfoKey + 1; i < UnknownDurationKey; i++ {
result = append(result, i)
}
for i := TestGetMapPropertyKey + 1; i < UnknownMapKey; i++ {
result = append(result, i)
}
return result
}

func GetKeyFromKeyName(keyName string) (Key, error) {
keyVal, ok := _keyNames[keyName]
if !ok {
Expand Down

0 comments on commit f84d560

Please sign in to comment.