Skip to content

feat(config): add .shopware-project.local.yml override support#908

Merged
Soner (shyim) merged 4 commits intomainfrom
feat/local-config-override
Mar 13, 2026
Merged

feat(config): add .shopware-project.local.yml override support#908
Soner (shyim) merged 4 commits intomainfrom
feat/local-config-override

Conversation

@shyim
Copy link
Member

Summary

  • Adds support for .shopware-project.local.yml files that are automatically merged on top of .shopware-project.yml, similar to how Docker Compose handles compose.override.yaml
  • Supports !reset YAML tag to clear fields (e.g., cleanup_paths: !reset [] empties the list instead of appending)
  • Supports !override YAML tag to fully replace fields instead of deep-merging (e.g., dump: !override { nodata: [cart] } replaces the entire dump section)

Merge semantics

Type Default !reset !override
Maps Deep merge Removes field Full replacement
Slices Append Clears / sets new values only Full replacement
Scalars Override wins Removes field Same as default

Example

# .shopware-project.yml (committed)
url: https://prod.example.com
build:
  cleanup_paths:
    - var/cache
    - var/log

# .shopware-project.local.yml (gitignored, personal)
url: https://local.example.com
build:
  cleanup_paths: !reset
    - my/custom/path

Test plan

  • Unit tests for localConfigFileName derivation
  • Scalar override (local value wins, base preserved when absent)
  • Slice append by default
  • !reset clears slices to empty
  • !reset with new values replaces list entirely
  • !override replaces entire map section
  • !reset on nested fields preserves siblings
  • No local file — behaves identically to before
  • Works alongside include: mechanism
  • Empty local file is a no-op
  • All existing tests continue to pass

… !override tags

Support local config overrides similar to Docker Compose's compose.override.yaml.
When a .shopware-project.local.yml file exists alongside .shopware-project.yml,
it is automatically merged on top with the following semantics:

- Scalars: local value wins
- Maps: deep-merged
- Slices: appended
- !reset tag: clears a field (e.g., `cleanup_paths: !reset []`)
- !override tag: replaces entirely instead of deep-merging
Copilot AI review requested due to automatic review settings March 12, 2026 11:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for automatically loading a per-user local override config file (e.g. .shopware-project.local.yml) and merging it on top of the main project config, with YAML tags to control merge semantics (!reset, !override).

Changes:

  • Adds YAML node scanning + map-merge utilities to implement !reset and !override semantics for local overrides.
  • Updates ReadConfig to detect and apply <config>.local.(yml|yaml) overrides.
  • Adds unit tests covering filename derivation and merge behaviors (scalar overrides, slice append/reset, map override, include interaction, and empty local file).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
internal/shop/config_override.go Implements local override filename derivation and YAML merge logic with !reset/!override.
internal/shop/config.go Integrates local override detection + merged-config loading into ReadConfig.
internal/shop/config_override_test.go Adds tests for local override filename derivation and merge semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

- Warn when os.Stat on local config file fails with non-NotExist error
- Standardize error message format to ReadConfig(%s) without space
- Use tagged switch instead of if-else chains (staticcheck QF1003)
- Add missing cases for ScalarNode and AliasNode (exhaustive)
@shyim Soner (shyim) merged commit 0de40c8 into main Mar 13, 2026
3 checks passed
@shyim Soner (shyim) deleted the feat/local-config-override branch March 13, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants