Public/ps1/Configuration/Get-ConfigurationValue.ps1

function Get-ConfigurationValue{
    param($name,[switch]$secure, $defaultValue)

    
    $folder = Get-LeftConnectConfigurationFolder

       
    if (Test-Path "$folder\config.json") {
    } else {
        "{}"|set-content "$folder\config.json"
    }

    $config = Get-Content "$folder\config.json" | ConvertFrom-Json
    # the prpoerty does not exist
    if (($config.$name -ne $null)) {
        if ($secure) {
            
            $secureString = $config.$name | ConvertTo-SecureString
            $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($secureString)
            [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
        } else {
            $config.$name
        }
    } else {
        $defaultValue
    }
}