Private/Get-LocalEnvMap.ps1
|
function Get-LocalEnvMap { [CmdletBinding()] param( [Parameter(Mandatory = $true)] [string]$Path ) if (-not (Test-Path $Path)) { throw "Environment file not found: $Path" } $map = @{} foreach ($line in Get-Content $Path) { if ($line -match '^\s*#' -or $line -notmatch '=') { continue } $key, $value = $line -split '=', 2 $map[$key.Trim()] = $value.Trim() } return $map } |