diff --git a/engine.ps1 b/engine.ps1 index 4b363df..5e5b95d 100644 --- a/engine.ps1 +++ b/engine.ps1 @@ -97,10 +97,16 @@ function Merge-Config($base, $override) { if (-not $override) { return $base } $merged = $base | ConvertTo-Json -Depth 10 | ConvertFrom-Json foreach ($section in $override.PSObject.Properties) { - if ($null -ne $merged.PSObject.Properties[$section.Name]) { + if ($section.Name -like "_*") { continue } + $baseSection = $merged.PSObject.Properties[$section.Name] + if ($null -eq $baseSection) { + $merged | Add-Member -NotePropertyName $section.Name -NotePropertyValue $section.Value + } elseif ($section.Value -is [System.Management.Automation.PSCustomObject]) { foreach ($prop in $section.Value.PSObject.Properties) { - $merged.$($section.Name).$($prop.Name) = $prop.Value + $merged.$($section.Name) | Add-Member -NotePropertyName $prop.Name -NotePropertyValue $prop.Value -Force } + } else { + $merged.$($section.Name) = $section.Value } } return $merged