WeareJH / wf2

PHP environments for Magento 1, Magento 2 & Wordpress
6 stars 3 forks source link

Multistore Support #116

Closed dcabrejas closed 3 years ago

dcabrejas commented 3 years ago

Background WF2 doesn't have native support for M2 multistore setups. Up until now the only way of setting up multistore using WF2 was to override the nginx file in the wf2.yml file and setting it all up manually using a nginx configuration file:

ie:

domains: [ crafters.m2, totallytiffany.m2 ]
php_version: 7.2

# For multistore
overrides:
    env:
        NginxDir: "./.wf2/nginx"

Functionality This PR adds native support for multistore to WF2 so that multiple stores can be defined in the wf2.yml file directly and have WF2 handle generating the right nginx configuration behind the scenes so that "it just works". The configuration looks as follows:

php_version: 7.1
domains: [ bbt.m2 ]

stores:
  - path_prefix: "/en/new-york"
    mage_run_code: "newyork_en"
    mage_run_type: "store"

  - path_prefix: "/en/london"
    mage_run_code: "london_en"
    mage_run_type: "store"

Caveats Only multistores by subdirectory or prefix are supported by this PR, multistore by different domains however is still supported by overriding the nginx file as it was before. This work could be extended in the future to support multistore domains fairly easily when the need arises.