Class BowireProvisionedEnvironments

Namespace
Kuestenlogik.Bowire.Environments
Assembly
Kuestenlogik.Bowire.dll

Merges host-declared environments into what the workbench reads, and keeps them out of what it writes (#49).

public static class BowireProvisionedEnvironments
Inheritance
BowireProvisionedEnvironments
Inherited Members

Remarks

The workbench sends the whole envelope back on every change. Without the strip on the way in, a host-declared environment would be saved into environments.json on the first edit anybody made — and from then on it would exist twice: once declared and once stored, diverging the moment the host's configuration changed. The merge is the visible half of this feature; the strip is the half that keeps it correct.

Methods

Merge(string, IReadOnlyList<BowireProvisionedEnvironment>)

Add provisioned to an envelope loaded from disk.

public static string Merge(string envelopeJson, IReadOnlyList<BowireProvisionedEnvironment> provisioned)

Parameters

envelopeJson string

The stored envelope: globals, environments, activeEnvId.

provisioned IReadOnlyList<BowireProvisionedEnvironment>

What the host declared. Empty is the common case.

Returns

string

The envelope with the declared environments appended, each marked provisioned: true so the workbench can render them as the host's rather than as something to edit. Returns the input unchanged when there is nothing to add or the envelope cannot be parsed — a corrupt file is the store's problem to report, not this function's to hide.

Strip(string, IReadOnlyList<BowireProvisionedEnvironment>)

Remove host-declared environments from an envelope the workbench is saving.

public static string Strip(string envelopeJson, IReadOnlyList<BowireProvisionedEnvironment> provisioned)

Parameters

envelopeJson string
provisioned IReadOnlyList<BowireProvisionedEnvironment>

Returns

string

Remarks

Matched by id rather than by the provisioned flag: the flag is something a client sends and could omit, and the ids are ours. Anything else in the envelope — globals, the active id, the person's own environments — passes through untouched.