src/Private/helpers.ps1
function SetEnvironmentVariablesFromObject { param ( [object]$obj, [string]$parentName="") foreach ($p in $obj.PSObject.Properties) { if ($p.Value.GetType().name -eq "PSCustomObject"){ $parentName = $parentName + $p.Name + "_" SetEnvironmentVariablesFromObject -obj $p.Value -parentName $parentName } else{ $VarName = ($parentName + $p.Name.replace(".", "_")).ToUpper() [System.Environment]::SetEnvironmentVariable($VarName, $p.Value, [System.EnvironmentVariableTarget]::Process) } } } |