Functions/Internal/GetFirstConfigFile.ps1

function GetFirstConfigFile{
    [CmdletBinding()]
    param(
        [string]$basePath
    )
    $basePath  = "$basePath*"
    if (-not (Test-Path $basePath) ) {
        throw "Config file not Found: `'$basePath`'"
    }
    $baseFiles = @(Get-ChildItem -Path $basePath)
    if ($baseFiles.count -gt 1) {
        throw "Multiple config files found for : `'$basePath`'"
    }
    
    return  $baseFiles[0].FullName
}