I'm trying to dockerize my mailing server and I'm having some troubles regarding how am I supposed to use environment variables inside Postfix and Dovecot configuration files (I'm using the latest packages available through apt for ubuntu:18.04).
I have already imported the variables I want to use within Dovecot.conf (1) and main.cf (2), but I honestly don't now exactly which syntax I must follow in order to use these.
(1) Dovecot.conf
import_environment= MYSQL_DATABASE, MYSQL_USER, MYSQL_PASSWORD, DOMAIN_NAME, CERTS_DIR, DOVECOT_SASL_PORT
(2) Postfix's main.cf
import_environment= MYSQL_DATABASE, MYSQL_USER, {MYSQL_PASSWORD}, DOMAIN_NAME, CERTS_DIR, DOVECOT_SASL_PORT
According to Dovecot's docs, I am supposed to use env:MYSQL_DATABASE
whenever I want to refer to my database, env:DOMAIN_NAME
whenever I want to refer to my domain name, and so on.
However, according to this mailing list from 2019, a user is refering to their ENV variables as %{env:EXAMPLE_VAR}
. Which approach is the correct one? Are they both equally valid?
About Postfix, on the other hand, I could not find anything related to what syntax must be used when referring to environment variables, and I'd very much appreciate if someone could tell me how should I proceed.
Thanks a lot!