Hey there,
I’m trying to get credentials (SMTP,…) out of the user-folder and I want to define them by environment variables.
For that I tried to create a “user/setup.php” with the following content:
<?php
return [
'plugins' => [
'email' => [
'mailer' => [
'smtp' => [
'port' => getenv('SMTP_PORT'),
'user' => getenv('SMTP_USER'),
'password' => getenv('SMTP_PASSWORD')
]
]
]
]
];
The issue is (took my quiet some time to find out) that everything I’ve defined is overwritten again by the email-plugin default-config:
enabled: true
from:
to:
mailer:
engine: sendmail
smtp:
server: localhost
port: 25
encryption: none
user:
password:
sendmail:
bin: "/usr/sbin/sendmail -bs"
content_type: text/html
debug: false
When I remove, for example “user:” it works as expected.
So, how can I achieve to define such config-values without now altering the email-plugin?
On deploy-pipelines it is very common to work with environment variables, especially when deploying grav as a docker-image.
Thanks!