ps/Modules/Alkami.PowerShell.Common/Public/Get-MasterConnectionString.ps1

18 lines
721 B
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
function Get-MasterConnectionString {
<#
.SYNOPSIS
Returns the Master Database Connection String
.DESCRIPTION
Reads the value from the appSetting named "AlkamiMaster" from the machine.config ConnectionStrings block
#>
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSPossibleIncorrectComparisonWithNull", "", Justification="Array Consolidation is Acceptable")]
param()
$machineConfig = Read-MachineConfig
$masterConnectionString = $machineConfig.Configuration.ConnectionStrings.ChildNodes | Where-Object {$_.Name -eq "AlkamiMaster"} | Select-Object -ExpandProperty connectionString
return ($masterConnectionString, $global:masterConnectionString -ne $null)[0];
}