refactor: implement dual-backend settings support (MySQL & MongoDB)#163
Open
NoLogicAlan wants to merge 5 commits intoremix-bot:mainfrom
Open
refactor: implement dual-backend settings support (MySQL & MongoDB)#163NoLogicAlan wants to merge 5 commits intoremix-bot:mainfrom
NoLogicAlan wants to merge 5 commits intoremix-bot:mainfrom
Conversation
Replaced the local file-based/MySQL SettingsManager with a new RemoteSettingsManager backed by MongoDB via the native driver. Changes: - Added RemoteSettingsManager class using mongodb package - Settings are now persisted and loaded from a MongoDB collection - Added upsert logic for creating/updating server settings - Added migrate.js script for one-time data migration from old storage - Updated config.json to include mongodb.uri and mongodb.database fields - Updated index.js to use RemoteSettingsManager
- migrate.js and index.js now read config.db to pick MongoDB or MySQL - Replaced hardcoded RemoteSettingsManager with createSettingsManager factory - No code changes needed to switch backends, just set "db" in config.json
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.
Changes
Implemented a dynamic database provider system that supports both MySQL and MongoDB, allowing the bot to adapt to different hosting environments.
config.jsonsettings.RemoteSettingsManager: Introduced a MongoDB-native class with efficient upsert logic to handle settings persistence without data duplication.index.jsto automatically initialize the correct provider at startup, ensuring a "Smart Fallback" if a specific backend isn't configured.migrate.jsto facilitate a smooth, one-time transition for users moving their existing data from MySQL to MongoDB collections.config.jsonto support separate connection strings and credentials for both database types.Checklist