Misc/Import-Config.ps1

function Import-Config {
    $settings = @{
        "tenant" = "";
        "subscription" = "";
        "keyVault" = "";
        "publisher" = "";
        "prefix" = "";
        "storageAccount" = "";
        "storageContainer" = "";
        "storageRelativePath" = "";
        "storageRelativePathClient" = "";
        "storageAccountExternalApps" = "";
        "storageContainerExternalApps" = "";
        "storageRelativePathExternalApps" = "";
    }

    if (Test-Path (Join-Path $PSScriptRoot "..\NavxBuildHelper-Config.psd1")) {
        $settings = Import-PowerShellDataFile -Path (Join-Path $PSScriptRoot "..\NavxBuildHelper-Config.psd1")
    }

    # if $settings does not contain tenant, subscription, keyVault, publisher, prefix, storageAccount, storageContainer, storageRelativePath initialize them
    if (!$settings.ContainsKey("tenant")) {
        $settings.Add("tenant", "")
    }
    if (!$settings.ContainsKey("subscription")) {
        $settings.Add("subscription", "")
    }
    if (!$settings.ContainsKey("keyVault")) {
        $settings.Add("keyVault", "")
    }
    if (!$settings.ContainsKey("publisher")) {
        $settings.Add("publisher", "")
    }
    if (!$settings.ContainsKey("prefix")) {
        $settings.Add("prefix", "")
    }
    if (!$settings.ContainsKey("storageAccount")) {
        $settings.Add("storageAccount", "")
    }
    if (!$settings.ContainsKey("storageContainer")) {
        $settings.Add("storageContainer", "")
    }
    if (!$settings.ContainsKey("storageRelativePath")) {
        $settings.Add("storageRelativePath", "{repository}/{version}/")
    }
    if (!$settings.ContainsKey("storageRelativePathClient")) {
        $settings.Add("storageRelativePathClient", "{repository}/{project}/{version}/")
    }
    if (!$settings.ContainsKey("storageAccountExternalApps")) {
        $settings.Add("storageAccountExternalApps", "")
    }
    if (!$settings.ContainsKey("storageContainerExternalApps")) {
        $settings.Add("storageContainerExternalApps", "")
    }
    if (!$settings.ContainsKey("storageRelativePathExternalApps")) {
        $settings.Add("storageRelativePathExternalApps", "")
    }

    $settings
}