According to Magento docs, one can override Magento Configuration variables using ENV variables. see https://devdocs.magento.com/guides/v2.3/config-guide/prod/config-reference-var-name.html
I'm trying to do that with some custom extension: https://github.com/magepal/magento2-gmail-smtp-app.git Basically I'm trying to feed SMTP configuration/credentials from ENV variables.
I do know that variables are formatted correctly, cause I put this in the pub/index.php
var_dump($_ENV);
die();
and I clearly see my ENV variables there.
I inject them using following snippet in php-fpm-pool config:
; magepal/magento2-gmail-smtp-app config
env[CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__ACTIVE] = $MAGENTO_SMTP_TRANSPORT_ACTIVE
env[CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__NAME] = $MAGENTO_SMTP_SENDER_HOST
env[CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__AUTH] = $MAGENTO_SMTP_AUTH
env[CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__SMTPHOST] = $MAGENTO_SMTP_HOST
env[CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__SMTPPORT] = $MAGENTO_SMTP_PORT
env[CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__USERNAME] = $MAGENTO_SMTP_USERNAME
env[CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__PASSWORD] = $MAGENTO_SMTP_PASSWORD
All values except CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__PASSWORD
or system/gmailsmtpapp/password
seem to be visible in Magento backend under Stores -> Configuration
.
Once I take the same value that I push into CONFIG__DEFAULT__SYSTEM__GMAILSMTPAPP__PASSWORD
and save it in the database - extension starts to work.
Magento version is:
"magento/product-community-edition": "2.3.4",
Recently we had similar problems with other extension and I'm starting to think that there is a bug in Magento core regarding reading sensitive vars from ENV.
Before I pull out debugger and start going through Magento guts, is there something that I'm missing here? Is there a known bug in magento that prevents reading ENV vars?