Add support for layered and plugin configurations (#1543)

- This adds support for reading configurations from
  a three layer hierarchy:
  1. User provided TOML
  2. Install root TOML
  3. Code defaults
- We add some code to support plugin configurations
  via the ConfigurationLoader. Each plugin can provide
  a struct with an accompanying id that gets used to
  parse the scoped section of the TOML.
This commit is contained in:
Noah Thornton
2026-05-12 14:35:21 -07:00
committed by GitHub
parent 940fefb7cd
commit a967399d48
28 changed files with 1165 additions and 712 deletions
@@ -61,6 +61,16 @@ public struct ConfigSnapshotDecoder: Sendable {
_ type: T.Type,
from snapshot: ConfigSnapshotReader
) throws -> T {
if type is any UnsupportedDictionaryDecoding.Type {
throw DecodingError.typeMismatch(
T.self,
DecodingError.Context(
codingPath: [],
debugDescription:
"ConfigSnapshotDecoder does not support decoding dictionaries (got \(T.self)). Represent dynamic keys as nested structs with known property names."
)
)
}
let decoder = ConfigSnapshotDecoderImpl(
snapshot: snapshot,
codingPath: [],