Class BowireProvisionedEnvironment

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

An environment the embedding host declares, rather than one a person typed into the workbench (#49).

public sealed class BowireProvisionedEnvironment
Inheritance
BowireProvisionedEnvironment
Inherited Members

Remarks

The gap this closes: an embedded host already has its own configuration — base URLs, tenant ids, whatever IOptions<T> resolved for the environment it is running in — and until now the only way to use those in the workbench was to read them out of appsettings.json and type them in again. Two copies, one of which is silently wrong the moment the other changes.

Declared, not stored. These are contributed on every start and never written to environments.json. A host that changes its configuration changes the environment by restarting, and nothing stale is left behind. It also means the workbench must not save them back — see BowireProvisionedEnvironments, which strips them on the way in for exactly that reason.

Constructors

BowireProvisionedEnvironment()

public BowireProvisionedEnvironment()

Properties

Id

The id these are addressed by, derived from the name.

public string Id { get; }

Property Value

string

Remarks

Prefixed so it cannot collide with the random ids the workbench mints, and stable across restarts so a request pinned to this environment keeps pointing at it. The name's case is kept rather than folded: the id only has to be stable and distinct, and folding it would be a normalisation nobody asked for (CA1308 is right to ask why).

Name

What the environment is called in the switcher.

public required string Name { get; init; }

Property Value

string

Variables

The variables, resolved by the host at start-up.

public Dictionary<string, string> Variables { get; init; }

Property Value

Dictionary<string, string>

Methods

Set(string, IFormattable?)

Set key from a value that is not a string.

public BowireProvisionedEnvironment Set(string key, IFormattable? value)

Parameters

key string
value IFormattable

Returns

BowireProvisionedEnvironment

Set(string, string?)

Set key from a value the host already has.

public BowireProvisionedEnvironment Set(string key, string? value)

Parameters

key string
value string

Returns

BowireProvisionedEnvironment

Remarks

Null and empty are kept rather than skipped: a variable the host meant to provide and could not resolve is worth seeing as empty in the switcher, because the alternative is a request that fails with an unsubstituted {{placeholder}} and no clue why.