diff --git a/bin/command/install/bootstrap.sh b/bin/command/install/bootstrap.sh index 4fb748f12..cacb0bbee 100644 --- a/bin/command/install/bootstrap.sh +++ b/bin/command/install/bootstrap.sh @@ -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}" diff --git a/docs/02-development/02-environment-variables.md b/docs/02-development/02-environment-variables.md new file mode 100644 index 000000000..31e1ad932 --- /dev/null +++ b/docs/02-development/02-environment-variables.md @@ -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. diff --git a/generator/src/templates/application/backend-gateway.yml.twig b/generator/src/templates/application/backend-gateway.yml.twig index c9805e135..1dde23a45 100644 --- a/generator/src/templates/application/backend-gateway.yml.twig +++ b/generator/src/templates/application/backend-gateway.yml.twig @@ -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} diff --git a/generator/src/templates/application/backoffice.yml.twig b/generator/src/templates/application/backoffice.yml.twig index 9381f760e..e360a994c 100644 --- a/generator/src/templates/application/backoffice.yml.twig +++ b/generator/src/templates/application/backoffice.yml.twig @@ -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} diff --git a/generator/src/templates/application/glue-backend.yml.twig b/generator/src/templates/application/glue-backend.yml.twig index 48cdf3cbc..f0d7da7e3 100644 --- a/generator/src/templates/application/glue-backend.yml.twig +++ b/generator/src/templates/application/glue-backend.yml.twig @@ -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} diff --git a/generator/src/templates/application/glue.yml.twig b/generator/src/templates/application/glue.yml.twig index 3b97b6c38..3655cd0fa 100644 --- a/generator/src/templates/application/glue.yml.twig +++ b/generator/src/templates/application/glue.yml.twig @@ -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} diff --git a/generator/src/templates/application/merchant-portal.yml.twig b/generator/src/templates/application/merchant-portal.yml.twig index 5e5c7f004..a19677a7a 100644 --- a/generator/src/templates/application/merchant-portal.yml.twig +++ b/generator/src/templates/application/merchant-portal.yml.twig @@ -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} diff --git a/generator/src/templates/application/yves.yml.twig b/generator/src/templates/application/yves.yml.twig index d11d8e14b..2ec4afb96 100644 --- a/generator/src/templates/application/yves.yml.twig +++ b/generator/src/templates/application/yves.yml.twig @@ -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} diff --git a/generator/src/templates/application/zed.yml.twig b/generator/src/templates/application/zed.yml.twig index d28273fc3..891a4a0bb 100644 --- a/generator/src/templates/application/zed.yml.twig +++ b/generator/src/templates/application/zed.yml.twig @@ -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}