icinga-powershell-framework/lib/config/Get-IcingaPowerShellConfig.psm1

21 lines
450 B
PowerShell
Raw Normal View History

function Get-IcingaPowerShellConfig()
{
param(
$Path = ''
);
$Config = Read-IcingaPowerShellConfig;
$PathArray = $Path.Split('.');
$ConfigObject = $Config;
foreach ($entry in $PathArray) {
if (-Not (Test-IcingaPowerShellConfigItem -ConfigObject $ConfigObject -ConfigKey $entry)) {
return $null;
}
$ConfigObject = $ConfigObject.$entry;
}
return $ConfigObject;
}