Private/Load-ConfigFile.ps1
function Load-ConfigFile { param ( [Parameter(Mandatory = $true)] [string]$ConfigPath ) if (-not (Test-Path -Path $ConfigPath)) { throw "Configuration file not found at path: $ConfigPath" } try { $configContent = Get-Content -Path $ConfigPath -Raw $config = $configContent | ConvertFrom-Json if (-not $config) { throw "Failed to parse configuration JSON file." } return $config } catch { throw "ERROR loading config file: $($_.Exception.Message)" } } |