feat(config): default configuration with merge support for downstream overrides#396
Merged
Cali0707 merged 2 commits intocontainers:mainfrom Oct 23, 2025
Merged
Conversation
… overrides
Creates the required infrastructure for downstream forks to be able to provide
default config overrides without modifying the original source code.
Downstream forks should be able to create merge/rebase scripts that
automatically accepted downstream merge conflicts in config_default_overrides.go
since this file will never change upstream.
Example usage for downstream forks:
To customize defaults, simply populate fields in the returned StaticConfig:
```go
func defaultOverrides() *StaticConfig {
return &StaticConfig{
ListOutput: "json", // Override default list output format
Toolsets: []string{"core"}, // Override default enabled toolsets
Port: "9000", // Override default port
}
}
```
Any fields specified here will override the base defaults defined in config_default.go.
Fields not specified will preserve their base default values.
Signed-off-by: Marc Nuri <marc@marcnuri.com>
This was referenced Oct 23, 2025
Skips toolset metadata tests in case there are config overrides. This is useful in downstream forks where the default toolsets might be different to those upstream. Signed-off-by: Marc Nuri <marc@marcnuri.com>
matzew
reviewed
Oct 23, 2025
Comment on lines
+14
to
+15
| overrides := defaultOverrides() | ||
| mergedConfig := mergeConfig(defaultConfig, overrides) |
matzew
reviewed
Oct 23, 2025
| } | ||
|
|
||
| func (s *ToolsetsSuite) TestDefaultToolsetsTools() { | ||
| if configuration.HasDefaultOverrides() { |
Collaborator
There was a problem hiding this comment.
I guess this is a good hook, for downstream.
Cali0707
approved these changes
Oct 23, 2025
Comment on lines
+4
to
+7
| return StaticConfig{ | ||
| // IMPORTANT: this file is used to override default config values in downstream builds. | ||
| // This is intentionally left blank. | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Creates the required infrastructure for downstream forks to be able to provide default config overrides without modifying the original source code.
Downstream forks should be able to create merge/rebase scripts that automatically accepted downstream merge conflicts in config_default_overrides.go since this file will never change upstream.
Example usage for downstream forks:
To customize defaults, simply populate fields in the returned StaticConfig:
Any fields specified here will override the base defaults defined in config_default.go. Fields not specified will preserve their base default values.
The second commit fixes #391 (AFAIU)
The full toolset metadata tests are skipped in case there are config overrides.
If downstream follows the convention:
The tests should not fail.