I come from a Java background, but now I'm supporting a PowerShell code base. In the PowerShell code base there are multiple modules that were written against a certain Azure environment. Now, we have another Azure environment that we need to support, and a lot of code needs to change. We don't want to fork the code base.
There are many places throughout the code where we need the equivalent of "If EnvA then do X, else if EnvB then do Y".
Coming from a Java background, I could use something like dependency injection and pass in a runtime arg that specifies the environment, then wire my dependencies based on the environment. I don't think dependency injection would work in this case, actually, from what I can tell it's not even really an option in PowerShell. Are there any PowerShell design patterns, or language agnostic design patterns, that are applicable for this type of scenario?
Thanks!