Repository navigation
Release v2.2.0: store codes only where a domain names one - #155
Merged
Merged
Conversation
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>
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.
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_CODEandMAGE_RUN_TYPEinto every vhost, so Magento looked up a store with that exact code even in single-store projects whose default code is notdefault. As agreed in #107, a host map now sets those variables only for domains that name astore_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
mapper variable and includes every file there into the samehttpblock, so two such projects make it reject the whole configuration withduplicate "MAGE_RUN_CODE" variableand serve nothing. All projects now share one file,000-magebox-store-map.conf, rebuilt from every project onmagebox start, and per-project files an earlier build left behind are removed.hostnamesmode, so a deliberately code-lessadmin.mystore.testinherited the code ofmystore.test. The PR's own test expected otherwise. Hosts are now matched exactly.mage_run_code/mage_run_typetostore_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 onmagebox start.store_typepassed straight through. Anything other thanstoreorwebsitenow fails validation.Docs
Domain properties table, the new
--store-typeflag, the FAQ answer that promisedMAGE_RUN_CODE=default, and how the shared map works in the multi-domain guide. Changelog andVERSIONbumped to 2.2.0.Verification
go test ./...gofmtNew 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_typevalidation 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