Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I pull Shopware 6 Plugins configurations from the .env file (like in Magento)?

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?

like image 953
Alex Avatar asked Oct 15 '25 16:10

Alex


1 Answers

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 uses dotenv to read the config settings, maybe detectable by a certain prefix, and persists the values via the SystemConfigService. 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.

like image 84
dneustadt Avatar answered Oct 19 '25 08:10

dneustadt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!