mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
24 lines
622 B
PowerShell
24 lines
622 B
PowerShell
|
|
function Write-IcingaPowerShellConfig()
|
||
|
|
{
|
||
|
|
param(
|
||
|
|
$Config
|
||
|
|
);
|
||
|
|
|
||
|
|
$ConfigDir = Get-IcingaPowerShellConfigDir;
|
||
|
|
$ConfigFile = Join-Path -Path $ConfigDir -ChildPath 'config.json';
|
||
|
|
|
||
|
|
if (-Not (Test-Path $ConfigDir)) {
|
||
|
|
New-Item -Path $ConfigDir -ItemType Directory | Out-Null;
|
||
|
|
}
|
||
|
|
|
||
|
|
$Content = ConvertTo-Json -InputObject $Config -Depth 100;
|
||
|
|
|
||
|
|
Set-Content -Path $ConfigFile -Value $Content;
|
||
|
|
|
||
|
|
if ($global:IcingaDaemonData.FrameworkRunningAsDaemon) {
|
||
|
|
if ($global:IcingaDaemonData.ContainsKey('Config')) {
|
||
|
|
$global:IcingaDaemonData.Config = $Config;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|