foxcpp / maddy

✉️ Composable all-in-one mail server.
https://maddy.email
GNU General Public License v3.0
4.81k stars 238 forks source link

cfgparser: add env_split for splitting of ENV variable values on comma #691

Open rjocoleman opened 4 months ago

rjocoleman commented 4 months ago

This PR adds a new config placeholder syntax, {env_split:VAR_NAME}, alongside the existing {env:VAR_NAME}

The use case of $(local_domains) = $(primary_domain) example.com multiple domains in Docker can now use this feature by setting an environment variable with a value like domain1.com,domain2.com. Using {env_split:OTHER_DOMAINS} will automatically convert this to domain1.com domain2.com, fitting into configurations that require space-separated values.

I have also added test cases for splitting, not split and mixing both.