tasks/common.tasks.ps1

# Synopsis: Allows build properties to be overriden by environment variables
task ApplyEnvironmentVariableOverrides {
    Get-ChildItem env:BUILDVAR_* | ForEach-Object {
        # strip the 'BUILDVAR_' prefix to leave the property to be overridden
        $varName = $_.Name -replace "^BUILDVAR_",""
        Write-Verbose "Overriding '$varName' from environment variable"
        Set-Variable -Scope script -Name $varName -Value $_.Value
    }
}