Sitecore / docker-tools

Sitecore Docker Tools are utilities which assist Sitecore developers in initializing and running containerized Sitecore environments.
MIT License
27 stars 17 forks source link

Support setting / getting literals in environment variables #48

Closed gwdt closed 1 year ago

gwdt commented 1 year ago

Hi, This PR adds support to allow developers to explicitly choose to set environment variables as a literal (ie. wrapped in single quotes).

E.G.
Set-EnvFileVariable -Variable 'VAR4' -Value 'literal$tring' -AsLiteral

Would write the following to the .env VAR4='literal$tring'

I believe this is an improvement due to:

Bonus: Also fixes a bug where the replacement of $ in Set-EnvFileVariable will result in different outcomes depending on if it was an existing variable (inserted via regex) vs a new variable (interpolated with the $'s doubled) in the .env file.