Skip to content

refactor: GlobalConfig.get should provide the default value from the RenovateOption #39949

@jamietanna

Description

@jamietanna

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:

  • getDefault may be useful
  • GlobalConfig.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

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority-3-mediumDefault priority, "should be done" but isn't prioritised ahead of others

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions