Skip to content

fix: preserve literal dollar signs in config values - #120

Open
AruneshDwivedi wants to merge 1 commit into
HeavyHorst:masterfrom
AruneshDwivedi:fix/dollar-in-config-values
Open

fix: preserve literal dollar signs in config values#120
AruneshDwivedi wants to merge 1 commit into
HeavyHorst:masterfrom
AruneshDwivedi:fix/dollar-in-config-values

Conversation

@AruneshDwivedi

Copy link
Copy Markdown
Contributor

readFileAndExpandEnv used os.ExpandEnv, which expands every bare $ in a config file. That corrupts literal dollar signs inside values such as a redis password (uhQhu4watyTgn$Q$ became uhQhu4watyTgn$), breaking connections. The change expands only the ${VAR} form, so intentional environment substitution still works while literal dollar signs are preserved. Added a regression test over readFileAndExpandEnv covering both forms.

readFileAndExpandEnv used os.ExpandEnv which strips bare $ characters
from values such as passwords, corrupting them. Expand only the ${VAR}
form so intentional environment substitution still works while literal
dollar signs are preserved.

Fixes HeavyHorst#88

Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com>
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