Skip to content
This repository was archived by the owner on May 23, 2025. It is now read-only.

Comments

add dotenv:dump in build hook#14

Open
iNem0o wants to merge 1 commit intoshopwareArchive:mainfrom
iNem0o:dump-env
Open

add dotenv:dump in build hook#14
iNem0o wants to merge 1 commit intoshopwareArchive:mainfrom
iNem0o:dump-env

Conversation

@iNem0o
Copy link

@iNem0o iNem0o commented Nov 8, 2022

Hello

Here is a change to dump the .env file as .env.local.php during the platform sh build hook and remove the overhead introduced by parsing the env files stack in production.

To ensure the retro-compatibility with the previous Shopware versions the dump is executed only when Shopware >= 6.4.16.0 is enabled in composer vendors


# dot env dump feature introduced in 6.4.16, we ensure that core >= 6.4.16 is enabled before dumping env
if (composer show -f json -N shopware/core ^6.4.16 2>&- || echo '{}') | jq '.name' | grep -q 'shopware/core'; then
./bin/ci dotenv:dump ${APP_ENV}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need that? You could just rm *.env 🤔

You should manage them in variables.env in this yaml?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is covering the case where you are versioning a default .env file in your Shopware project with generic variables which are the same everywhere (platform.sh or not) and you want to deploy it without performance lost in production.

I just realized that there is no .env in the default template but only a .env.dist, so as you pointed out this is not really needed here in the standard configuration.

Maybe we could add it commented as an available helper for project with a versionned .env file ? Otherwise we can close the PR

Regards

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants