Skip to content

Commit

Permalink
fix: small issue with enabled service check
Browse files Browse the repository at this point in the history
fix: build script traversal of context folders
docs: better documentation about nginx multistore setup
  • Loading branch information
Janos Miko committed Feb 2, 2021
1 parent 51d8670 commit b7cdc14
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.6-beta
0.1.7-beta
14 changes: 10 additions & 4 deletions docs/configuration/multipledomains.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,17 @@ There are two (and many more) ways to configure Magento run params (`MAGE_RUN_TY
* Nginx mappings
* Composer autoload

#### Nginx: Set MAGE_RUN_CODE/MAGE_RUN_TYPE by HTTP_HOST mapping
#### Nginx mappings

Add the following file to you project folder `./.reward/nginx/http-maps.conf` with the content.
Nginx makes it possible to map values to variables based on other variable's values.

Exammple:
Add the following file to you project folder `./.reward/nginx/http-maps.conf` with the content below.
Don't forget to restart your nginx container. `reward env restart -- nginx`

* if the `$http_host` value is `sub.example.test`, nginx will map value `store_code_1` to `$MAGE_RUN_CODE`.
* if the `$http_host` value is `sub.example.test`, nginx will map value `store` to `$MAGE_RUN_TYPE`.

Here's an example:
```
map $http_host $MAGE_RUN_CODE {
example.test default;
Expand All @@ -91,7 +97,7 @@ map $http_host $MAGE_RUN_TYPE {
}
```
#### Composer: Autoload php file
#### Composer autoload php file
When multiple domains are being used to load different stores or websites on Magento 2, the following configuration should be defined in order to set run codes and types as needed.
Expand Down
7 changes: 6 additions & 1 deletion images/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ function build_image () {
IMAGE_TAG+=":${TAG_SUFFIX}"
fi

if [[ -d "$(echo "${BUILD_DIR}" | cut -d/ -f1)/context" ]]; then
# Check if the context directory exist in the subdirectory.
# If not go up a level and try use that context dir.
# If that neither exist, ignore.
if [[ -d "$(echo "${BUILD_DIR}" | rev | cut -d/ -f2- | rev)/context" ]]; then
BUILD_CONTEXT="$(echo "${BUILD_DIR}" | rev | cut -d/ -f2- | rev)/context"
elif [[ -d "$(echo "${BUILD_DIR}" | cut -d/ -f1)/context" ]]; then
BUILD_CONTEXT="$(echo "${BUILD_DIR}" | cut -d/ -f1)/context"
else
BUILD_CONTEXT="${BUILD_DIR}"
Expand Down
2 changes: 1 addition & 1 deletion internal/svc.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func SvcGenerateTraefikDynamicConfig() error {
func SvcEnabled(name string) bool {
key := AppName + "_" + name
if viper.IsSet(key) {
viper.GetBool(key)
return viper.GetBool(key)
}

return true
Expand Down

0 comments on commit b7cdc14

Please sign in to comment.