mirror of
https://github.com/apple/container.git
synced 2026-09-27 17:36:08 -04:00
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:
@@ -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: [],
|
||||
|
||||
Reference in New Issue
Block a user