Misc/Import-Config.ps1

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

    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", "")
    }

    $settings
}