In Magento 2 we store config data which is only relevant for production in the env.php
– so it is not included in DB dumps and such.
Is this possible in Shopware 6 ?
For example, if I have a plugin config like
JopsoMonitoring.config.sentryEnvironment
I can already call
`bin/console system:config:set JopsoMonitoring.config.sentryEnvironment dev’
But can I also write something like
JopsoMonitoring.config.sentryEnvironment
in the .env
?
2
Answers
FroshTools support this feature now
https://github.com/FriendsOfShopware/FroshTools#override-system_config-with-config-files
That’s currently not supported, but it’s an interesting idea. The
SystemConfigService
relies on the settings being stored in the database so the service would have to be refactored to account for environment variables. A quick solution would be to write a CLI command implementation that usesdotenv
to read the config settings, maybe detectable by a certain prefix, and persists the values via theSystemConfigService
. That command could then be automated to be executed after deployment.If third-party tool are an option, you could have a look at
shopware-cli
that comes with a command to push config setting from a yml file.