Skip to content

Release v2.2.0: store codes only where a domain names one - #155

Merged
jakwinkler merged 3 commits into
mainfrom
release/2.2.0
Sep 28, 2026
Merged

jakwinkler merged 3 commits into
mainfrom
release/2.2.0

Conversation

@jakwinkler

Copy link
Copy Markdown
Contributor

Releases the multistore change from #109 by @LouisdeLooze, closing #107, with the fixes it needed before it could ship.

What it does

MageBox injected MAGE_RUN_CODE and MAGE_RUN_TYPE into every vhost, so Magento looked up a store with that exact code even in single-store projects whose default code is not default. As agreed in #107, a host map now sets those variables only for domains that name a store_code, and one project can mix store and website codes. The contributor's commit is kept intact with his authorship.

What had to change before merging

  • A second multistore project would have stopped nginx. The map was written per project into the shared vhosts directory. nginx allows one map per variable and includes every file there into the same http block, so two such projects make it reject the whole configuration with duplicate "MAGE_RUN_CODE" variable and serve nothing. All projects now share one file, 000-magebox-store-map.conf, rebuilt from every project on magebox start, and per-project files an earlier build left behind are removed.
  • Store codes leaked into subdomains. The map used a leading dot in nginx's hostnames mode, so a deliberately code-less admin.mystore.test inherited the code of mystore.test. The PR's own test expected otherwise. Hosts are now matched exactly.
  • Existing configs would have broken silently. The PR renamed mage_run_code / mage_run_type to store_code / store_type, but the config loader ignores unknown keys, so projects using the old names would have lost their codes without a word. The old names still work and print a deprecation warning on magebox start.
  • Invalid store_type passed straight through. Anything other than store or website now fails validation.

Docs

Domain properties table, the new --store-type flag, the FAQ answer that promised MAGE_RUN_CODE=default, and how the shared map works in the multi-domain guide. Changelog and VERSION bumped to 2.2.0.

Verification

Check Result
go test ./... 26 packages pass
golangci-lint v2 0 issues
gofmt clean

New tests cover exactly one map per variable across several projects, exact host matching, deterministic ordering, removal of legacy per-project files, removal of the shared file when nothing uses store codes, store_type validation and the deprecated-key migration.

After merge, the tag has to be deleted and re-pushed locally so the release build runs, as with previous releases.

🤖 Generated with Claude Code

LouisdeLooze and others added 3 commits September 28, 2026 13:55
Magento resolved a store by code even for single-store projects, because
MageBox always injected MAGE_RUN_CODE and MAGE_RUN_TYPE. A host map now
sets them only for domains that name a store code, which also supports
store and website mode in one project and removes two optional settings.

Closes #107
Follow-up to #109, which is otherwise ready.

The map was written per project into the shared vhosts directory. nginx
accepts one map per variable and includes every file in that directory
into the same http block, so a second multistore project would have made
it reject the whole configuration with `duplicate "MAGE_RUN_CODE"
variable` and serve nothing at all. All projects now share one file,
rebuilt from every project when any of them starts, and per-project files
from an earlier build are removed.

Hosts are matched exactly. With a leading dot in nginx's `hostnames`
mode, a deliberately code-less admin.mystore.test inherited the code of
mystore.test, which the PR's own test expected not to happen.

mage_run_code and mage_run_type keep working with a deprecation warning.
The loader ignores unknown keys, so renaming them outright would have let
existing multistore projects lose their codes silently and serve the
wrong store.

A store_type other than store or website now fails validation instead of
reaching Magento as a value it does not understand.

Docs: the domain properties table, the --store-type flag, the FAQ answer
that promised MAGE_RUN_CODE=default, and how the shared map works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

📦 PR build artifacts

Built from 55184eb — view run. Artifacts expire in 14 days.

Note: artifact download links require being signed in to GitHub with access to this repository.

@jakwinkler
jakwinkler merged commit 0e63600 into main Sep 28, 2026
12 checks passed
@jakwinkler
jakwinkler deleted the release/2.2.0 branch September 28, 2026 13:53
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