Private/Utils/Import-PluginConfiguration.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function Import-PluginConfiguration
{
    $pluginConfig = Join-Path $PSScriptRoot 'plugin-config.json'

    if (-not (Test-Path -Path $pluginConfig -PathType Leaf))
    {
        Write-Warning "Plugin config file '$pluginConfig' not found"
        return
    }

    try
    {
        Get-Content -Path $pluginConfig -Raw | ConvertFrom-Json
    }
    catch
    {
        Write-Warning "$($pluginConfig): File is corrupt. Not importing"
        $null
    }
}