-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
When interacting with the GlobalConfig.get method, we're hardcoding the default value we want to have returned to us (if we care).
The trouble with this is that it's possibly different from the global configuration option's inbuilt default.
Noticed as part of #39945, we want to get the default values that are set on allowedUnsafeExecutions, but they are not currently returned.
This means that we need to provide - in the call site - a default value, which may not stay in sync as the global config option changes.
We should refactor this, so calling GlobalConfig.get will return the actual default value from the config option, if one is available.
This would mean that the default value for GlobalConfig.get(key, defaultValue) would no longer need to be provided.
Other notes:
getDefaultmay be usefulGlobalConfig.config[option] = (config[option] ?? default[option]) as never;here- Trying to do this introduces an import cycle between the configuration options themselves and the
GlobalConfig's definition, likely requiring some more significant refactoring