mesh/delivery-group group feat/sdk1 rejected: composed together: the checker's verdict at the members' heads (428d048dd50a): unit: git.novox.be/novox/mesh-sdk/…
mesh/delivery closed: a newer head of the same pull request
mesh/check failed: unit: git.novox.be/novox/mesh-sdk/go/process.TestStatePutWritesAKeyWhole: a Put through a short blackout: 0, mesh-mail's state send…
Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
61 lines
2.7 KiB
Go
61 lines
2.7 KiB
Go
package catalogue
|
|
|
|
// SettingDeclaration is one key's default, as the definition gives it.
|
|
type SettingDeclaration struct {
|
|
// Kind says what sort of value this is. `preference` is the only kind with a default; it is
|
|
// stated rather than assumed so a reviewer sees the claim being made.
|
|
Kind string `json:"kind"`
|
|
// Default is the value when no layer sets the key: a string, a number or a boolean.
|
|
Default any `json:"default"`
|
|
// Why this default: one sentence for whoever wonders whether to change it.
|
|
Why string `json:"why"`
|
|
|
|
// The config form's declaration (novox/hq ADR 0348 §4, config.go): none of these is said under
|
|
// `settings`, and neither Kind nor Why under `config`.
|
|
|
|
// Type is number, string or boolean; object or list only when Trusted.
|
|
Type string `json:"type,omitempty"`
|
|
// Description says what the value is, including its unit.
|
|
Description string `json:"description,omitempty"`
|
|
// Enum, Minimum, Maximum and Pattern are its validation: the values it may take, the bounds of a
|
|
// number, and the whole of a string matching the pattern.
|
|
Enum []any `json:"enum,omitempty"`
|
|
Minimum *float64 `json:"minimum,omitempty"`
|
|
Maximum *float64 `json:"maximum,omitempty"`
|
|
Pattern string `json:"pattern,omitempty"`
|
|
// Trusted is a value that decides what runs or who can reach what (ADR 0348 §8).
|
|
Trusted bool `json:"trusted,omitempty"`
|
|
// Predefined is the predefined key the value falls back to, of the same type (ADR 0348 §2, §7).
|
|
Predefined string `json:"predefined,omitempty"`
|
|
// Required is the operator's own value: it has no default (ADR 0348 §4).
|
|
Required bool `json:"required,omitempty"`
|
|
// Runtime is a value the module's code reads at runtime rather than one placed in a file (ADR 0348 §5).
|
|
Runtime bool `json:"runtime,omitempty"`
|
|
}
|
|
|
|
// KindPreference is the kind of a setting that may have a default.
|
|
const KindPreference = "preference"
|
|
|
|
// DefaultLayer is what the layer of a module's own defaults is called where a value's source is said.
|
|
// Only said: the layer is recognised by Layer.Default, never by this name, which a node may also have.
|
|
const DefaultLayer = "default"
|
|
|
|
// meshWords are the settings keys the mesh reads itself; a module declares none of them.
|
|
var meshWords = map[string]bool{
|
|
PortsSetting: true, ExposeSetting: true, ReachSetting: true, EndpointsSetting: true,
|
|
PlacesSetting: true, AccessesSetting: true, NetworksSetting: true,
|
|
}
|
|
|
|
// SettingSource is one key's effective value and the layer it came from.
|
|
type SettingSource struct {
|
|
Key string
|
|
Value any
|
|
// From is DefaultLayer, MeshWideLayer or the node's name.
|
|
From string
|
|
// FromDefault is whether the value is the module's default, whatever From reads.
|
|
FromDefault bool
|
|
// Default is the module's default, when it gives one.
|
|
Default any
|
|
HasDefault bool
|
|
}
|