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:
Improved DX giving developers the explicit choice of when to use literals when setting/getting env vars
Allows for special characters in keys/secrets when setting/getting env vars that may have been generated in other systems, which in some cases may not be avoided
Improves IDE syntax highlighting in .env files when there are special characters (special characters in long strings throw it off)
Enhances support for all previous flags when using Get-SitecoreRandomString e.g. -DisallowSpecial, -DisallowDollar etc where used
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.
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.