Private/Config/Read-PWSHYBKPIVConfigFile.ps1
|
function Read-PWSHYBKPIVConfigFile { <# .SYNOPSIS Reads and parses the Posh-YBKPIV JSON configuration file. .DESCRIPTION Reads Config\Posh-YBKPIV.json fresh from disk on every call (no in-memory cache), so edits to the file take effect on the next cmdlet invocation without reloading the module. Throws if the file is missing, since the config ships embedded with the module and its absence indicates a broken or incomplete install rather than a "not configured yet" state. .OUTPUTS PSCustomObject. The parsed configuration (installation, cmdletWrapping, Logging). .EXAMPLE Read-PWSHYBKPIVConfigFile Returns the parsed Posh-YBKPIV.json configuration. #> [CmdletBinding()] [OutputType([PSCustomObject])] param() if (-not (Test-Path -Path $script:ConfigPath -PathType Leaf)) { throw "Posh-YBKPIV configuration file not found at '$script:ConfigPath'. Reinstall or repair the module." } $raw = Get-Content -Path $script:ConfigPath -Raw -Encoding UTF8 $raw | ConvertFrom-Json } |