ps/Modules/Alkami.PowerShell.Configuration/Public/Test-IsDeveloperMachine.ps1

33 lines
1.2 KiB
PowerShell
Raw Permalink Normal View History

2023-05-30 22:51:22 -07:00
function Test-IsDeveloperMachine {
<#
.SYNOPSIS
Is the current machine a developer's environment or a QA/Staging/Production environment?
.PARAMETER ComputerName
What computer do we check, defaults to localhost
#>
[CmdletBinding()]
[OutputType([System.Boolean])]
param (
[string]$ComputerName = 'localhost'
)
$environmentType = (Get-EnvironmentType -ComputerName $ComputerName)
$environmentTypeNames = @('Development', 'Unknown', 'SDK', 'Sandbox', '', $null)
if ((Select-AlkamiTeaServers -Servers $ComputerName) -or
(Select-AlkamiAppServers -Servers $ComputerName) -or
(Select-AlkamiMicServers -Servers $ComputerName) -or
(Select-AlkamiWebServers -Servers $ComputerName)) {
return $false
} else {
return ($environmentTypeNames -contains $environmentType)
}
}
Set-Alias -Name Test-IsDevelopmentEnvironment -Value Test-IsDeveloperMachine
# If the tag doesn't exist this is a development machine or should be treated as such.
# This is the only place that we can accept a missing env-type var
# return ([string]::IsNullOrWhiteSpace($environmentType)) -or ($environmentTypeNames -contains $environmentType)