Class SecretOverlayMerger
- Namespace
- Kuestenlogik.Bowire.Workspace.Git
- Assembly
- Kuestenlogik.Bowire.Workspace.Git.dll
Merges <env>.secrets.json overlays on top of the
committed <env>.json at load time. Implements the
secret-separation convention shipped in Phase 1: the non-secret
half is the reviewable, git-tracked half; .secrets.json
siblings carry tokens and are .gitignore'd at workspace
init.
public static class SecretOverlayMerger
- Inheritance
-
SecretOverlayMerger
- Inherited Members
Remarks
Both documents are JSON objects with the per-env shape the
workbench writes — typically { id, name, variables: { … } }
— but the overlay only needs to carry the keys it overrides. The
merger walks the object's top-level properties; when a property
is itself an object (e.g. variables), the merge recurses
one level so a partial secrets file with just one new variable
adds rather than wholly replaces the base map.
Override semantics:
- Scalar property in overlay replaces scalar / array / object in base.
- Object property in overlay merges with object property in
base (recursive one level — flat maps inside
variables). - Array property in overlay replaces array in base (no concat).
Keeps the rule predictable: a secrets file never deletes a base entry, only adds / overrides it.
Methods
Merge(string?, string?)
Merge overlayJson on top of
baseJson and return the serialised result.
Either input may be null; a null overlay returns the
base verbatim, a null base falls back to the overlay alone.
public static string? Merge(string? baseJson, string? overlayJson)
Parameters
Returns
Exceptions
- JsonException
Either input is not a valid JSON object.