42 lines
1.2 KiB
PowerShell
42 lines
1.2 KiB
PowerShell
function Set-EnvironmentNameSafeDesignation {
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
Get the App Setting of Environment.NameSafeDesignation
|
|
|
|
.PARAMETER Value
|
|
[string] The appSetting value to set, if it's different than the existing file
|
|
|
|
.PARAMETER ComputerName
|
|
[string] The computer to connect to Defaults to localhost
|
|
|
|
#>
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$Value,
|
|
[Parameter(Mandatory = $false)]
|
|
[string]$ComputerName
|
|
)
|
|
|
|
$logLead = (Get-LogLeadName)
|
|
|
|
if ([string]::IsNullOrWhiteSpace($ComputerName)) {
|
|
Write-Warning "$logLead : ComputerName is null or whitespace, assigning 'localhost' to ComputerName"
|
|
$ComputerName = 'localhost'
|
|
}
|
|
|
|
$params = @{
|
|
Key = "Environment.NameSafeDesignation"
|
|
Value = $Value
|
|
ComputerName = $ComputerName
|
|
}
|
|
|
|
$appSetting = Set-AppSetting @params
|
|
|
|
# Adding environment variable from SRE-17307
|
|
Set-EnvironmentVariable -Name "ALKAMI_ENVIRONMENT_NAME" -Value $Global:Name_Safe_Designation -StoreName "Machine"
|
|
|
|
Write-Verbose "$logLead : ComputerName: [$ComputerName] App Setting value: [$Value]"
|
|
return $appSetting
|
|
} |