Draft: Extendable configuration providers and TOML provider #267
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extends configuration API to allow swappable configuration readers and writers.
This PR also generally updates the configuration API.
As this is a Draft PR, suggestions and ideas are welcome.
Description
This PR cleans up and extends BepInEx configuration API. The most important changes are
Motivation and Context
At the moment, BepInEx supports a subset of TOML/INI with which handling compound data types is not easy.
Additionally, there have been calls for supporting writing to different configuration formats (JSON, INI, msgpack) and stores (file, memory, SQL, web).
This PR attempts to add general support for new configuration formats and sources by introducing configuration providers.
Configuration providers
A configuration provider is a low-level abstraction over a configuration store. A configuration provider implements a basic CRU(D) API and thus can
A path is represented as a
string[]
, which allows for nesting and arrays.A configuration node contains minimal metadata to read/write a single non-compound configuration value. The layout of a node is
A single node must always contain a non-compound value (number, string, date). Compound data types are, in turn, represented as multiple nodes.
This PR will also add a proper TOML provider.
Configuration API cleanup
TODO: Plan out a new API and consolidate suggestions of other PRs.
TODOS:
Bind<T>
to compound types