ps/Modules/Alkami.PowerShell.Services/Public/Enable-Nag.ps1
2023-05-30 22:51:22 -07:00

45 lines
1.4 KiB
PowerShell

function Enable-Nag {
<#
.SYNOPSIS
Enable Nag by setting the service to Manual and clearing bogus values from the config
.PARAMETER nagPath
The path where Nag is installed. Defaults to (Get-OrbPath)\Nag
.NOTES
The Nag service must be started separately
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$false)]
[string]$nagPath
)
$nagServiceName = 'Alkami Nag Service'
$logLead = (Get-LogLeadName)
if([string]::IsNullOrEmpty($nagPath)) {
$nagPath = (Join-Path(Get-OrbPath) "\Nag")
}
Write-Verbose "$logLead : Using Nag Path $nagPath"
$nagService = (Get-Service -Name $nagServiceName -ErrorAction SilentlyContinue)
if ($null -eq $nagService) {
Write-Warning "$logLead : The |$nagServiceName| is not installed on this machine"
return
}
# 1. Enable service
Enable-Service -ServiceObject $nagService
# 2. Un-mangle the config
#
# ToDo: When dev changes the app setting key in ORB we'll remove the term WhiteList from this function
# Until then, we will match the development code base to avoid any confusion
# See: SRE-14133
$nagConfig = (Join-Path $nagPath "Alkami.App.Nag.Host.Service.exe.config")
Set-AppSetting -key 'TenantFIWhitelistRegex' -value '' -filePath $nagConfig
Set-AppSetting -key 'JobNameWhitelistRegex' -value '' -filePath $nagConfig
}