Skip to content

Commit

Permalink
Introduced support of the .env for the local development (#537)
Browse files Browse the repository at this point in the history
* Introduced support of the .env for the local development

* Update the documentation
  • Loading branch information
alexanderM91 authored Dec 12, 2024
1 parent b9109ce commit 16517a0
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bin/command/install/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ function Command::bootstrap() {
if [ -d "${projectDeployTemplatesDirectory}" ]; then
cp -rf "${projectDeployTemplatesDirectory}" "${tmpDeploymentDir}/project-deploy-templates"
fi
[ -f "./.env" ] && { mkdir -p "${tmpDeploymentDir}/env" && cp "./.env" "${tmpDeploymentDir}/env/.env"; } || { mkdir -p "${tmpDeploymentDir}/env" && touch "${tmpDeploymentDir}/env/.env"; }

Console::end "[DONE]"

Console::info "${INFO}Running generator${NC}"
Expand Down
20 changes: 20 additions & 0 deletions docs/02-development/02-environment-variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Passing Vulnerable Secrets for Local Development

This document explains how to use a **.env** file **for the local environment**.

## Configuring .env

1. Navigate to the **root directory of your project** and create a file named **.env**.
2. Set up the necessary secrets for your environment.
3. Bootstrap the Docker SDK:
```bash
docker/sdk boot {deploy file name}
```
4. Start the local project:
```bash
docker/sdk up
```

Once the project is running, all secrets from the .env file will be accessible to all Spryker applications, such as Backoffice, Yves, etc.

**Note:** Ensure that **.env** is added to **.gitignore** (if not already) to prevent committing vulnerable secrets to the repository.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'spryker.project': ${SPRYKER_DOCKER_PREFIX}:${SPRYKER_DOCKER_TAG}
env_file:
- ${DEPLOYMENT_PATH}/env/{{ applicationName }}.env
- ${DEPLOYMENT_PATH}/env/.env
environment:
SPRYKER_TESTING_ENABLED: ${SPRYKER_TESTING_ENABLE}
SPRYKER_XDEBUG_HOST_IP: ${SPRYKER_XDEBUG_HOST_IP}
Expand Down
1 change: 1 addition & 0 deletions generator/src/templates/application/backoffice.yml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'spryker.project': ${SPRYKER_DOCKER_PREFIX}:${SPRYKER_DOCKER_TAG}
env_file:
- ${DEPLOYMENT_PATH}/env/{{ applicationName }}.env
- ${DEPLOYMENT_PATH}/env/.env
environment:
SPRYKER_TESTING_ENABLED: ${SPRYKER_TESTING_ENABLE}
SPRYKER_XDEBUG_HOST_IP: ${SPRYKER_XDEBUG_HOST_IP}
Expand Down
1 change: 1 addition & 0 deletions generator/src/templates/application/glue-backend.yml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'spryker.project': ${SPRYKER_DOCKER_PREFIX}:${SPRYKER_DOCKER_TAG}
env_file:
- ${DEPLOYMENT_PATH}/env/{{ applicationName }}.env
- ${DEPLOYMENT_PATH}/env/.env
environment:
SPRYKER_TESTING_ENABLED: ${SPRYKER_TESTING_ENABLE}
SPRYKER_XDEBUG_HOST_IP: ${SPRYKER_XDEBUG_HOST_IP}
Expand Down
1 change: 1 addition & 0 deletions generator/src/templates/application/glue.yml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'spryker.project': ${SPRYKER_DOCKER_PREFIX}:${SPRYKER_DOCKER_TAG}
env_file:
- ${DEPLOYMENT_PATH}/env/{{ applicationName }}.env
- ${DEPLOYMENT_PATH}/env/.env
environment:
SPRYKER_TESTING_ENABLED: ${SPRYKER_TESTING_ENABLE}
SPRYKER_XDEBUG_HOST_IP: ${SPRYKER_XDEBUG_HOST_IP}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'spryker.project': ${SPRYKER_DOCKER_PREFIX}:${SPRYKER_DOCKER_TAG}
env_file:
- ${DEPLOYMENT_PATH}/env/{{ applicationName }}.env
- ${DEPLOYMENT_PATH}/env/.env
environment:
SPRYKER_TESTING_ENABLED: ${SPRYKER_TESTING_ENABLE}
SPRYKER_XDEBUG_HOST_IP: ${SPRYKER_XDEBUG_HOST_IP}
Expand Down
1 change: 1 addition & 0 deletions generator/src/templates/application/yves.yml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'spryker.project': ${SPRYKER_DOCKER_PREFIX}:${SPRYKER_DOCKER_TAG}
env_file:
- ${DEPLOYMENT_PATH}/env/{{ applicationName }}.env
- ${DEPLOYMENT_PATH}/env/.env
environment:
SPRYKER_TESTING_ENABLED: ${SPRYKER_TESTING_ENABLE}
SPRYKER_XDEBUG_HOST_IP: ${SPRYKER_XDEBUG_HOST_IP}
Expand Down
1 change: 1 addition & 0 deletions generator/src/templates/application/zed.yml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'spryker.project': ${SPRYKER_DOCKER_PREFIX}:${SPRYKER_DOCKER_TAG}
env_file:
- ${DEPLOYMENT_PATH}/env/{{ applicationName }}.env
- ${DEPLOYMENT_PATH}/env/.env
environment:
SPRYKER_TESTING_ENABLED: ${SPRYKER_TESTING_ENABLE}
SPRYKER_XDEBUG_HOST_IP: ${SPRYKER_XDEBUG_HOST_IP}
Expand Down

0 comments on commit 16517a0

Please sign in to comment.