Project Codex - Config / Settings API#2442
Draft
Axionize wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I'm starting a new "Project" system to track major features/refactors. The first one is Project Codex.
The Problem
Right now, Grim's config system is too tightly coupled to the underlying library (configuralize).
The Plan
I want to decouple the Data (the file/values) from the Loader (the logic).
I've drafted a new design using a Handler pattern. The goal is to let plugins register a source, and the manager figures out how to handle it. This keeps the API clean and lets us add support for things like Redis later or have extensions register sources without changing the API.
Proposed API
Here is what I'm thinking for the usage. Does this look annoying to use?
1. Registering a File (Standard usage)
2. Custom Sources (Future proofing)
If someone wants to write a Redis loader later, they can register a handler that converts Redis data into a simple Map, and Grim handles the rest.
Related Grim API Draft: GrimAnticheat/GrimAPI#17
I'm drafting the PR right now, but before I commit to this:
ConfigSource(Data) andSourceHandler(Logic) too much, or do you think it's necessary for long-term support?ConfigSourceandConfigManager. Is that clear enough?FileorMap<String, Object>as inputs. Is there any use case where this wouldn't work?Let me know what you think.