Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

rjocoleman
Copy link

@rjocoleman rjocoleman commented Mar 16, 2024

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

  • {env:VAR_NAME}: Substitutes the value of the environment variable VAR_NAME as is, preserving its format, including any commas.
  • {env_split:VAR_NAME}: Substitutes the value of the environment variable VAR_NAME, converting any commas in the value into spaces. This is particularly useful for configurations that expect space-separated lists but are populated from environment variables that naturally format such lists as comma-separated strings.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant