Adding DisallowDollar as a switch to Get-SitecoreRandomString.ps1 in docker-tools repo

I had earlier blogged about a Pull Request for disallowing special characters due to the presence of $ character in the generated random string while executing up.ps1.

As that PR was approved, based on Rob Earlam's pointer to the docker-tools repository that holds the actual Get-SitecoreRandomString.ps1, I decided to add the disallowdollar switch to the Get-SitecoreRandomString.ps1

Here is the change that does the job:

Edit: Fixed a rookie error that missed the closing bracket in the above condition on 24/apr and resubmitted!

If this change is merged, you can then use the disallowdollar switch as follows in XM-Cloud init.ps1 and other relevant code repositories:

Example: Get-SitecoreRandomString -Length 10 -EnforceComplexity -DisallowDollar


Note that I pulled the function to a new psm1 file in a new directory and imported the same to test just this piece of functionality and hence the Get-SitecoreRandomString2 name change in the about screen shot! But, you should be able to see in the verbose message that $ is not present during the random string generation!

Pull Request



Comments