Own ConfigManager in Core; resolve config via DI instead of the singleton
Core holds a ConfigManager member, keeps it synced (updateConfig(config_)), and provides it as a service. ConfigManager.cpp drops the instance() definition. MusicManager gets the manager via setConfigManager() and reads sections through it (former ECHOION_BOT/YOUTUBE/NETWORK sites); RpcInfoCommand resolves it from the registry via ctx.service<Api::ConfigManager>(). Build green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
f7553d10d3
commit
0e08ccaefa
6 files changed
+29
-14
No files matched your search
@@ -5,6 +5,7 @@
|
||||
#include "MusicManager.hpp"
|
||||
#include "NetworkClient.hpp"
|
||||
#include "RpcServer.hpp"
|
||||
#include <ConfigManager.hpp>
|
||||
#include <ConfigTypes.hpp>
|
||||
#include <CoreInterface.hpp>
|
||||
#include <Void/Async/EventBus.hpp>
|
||||
@@ -192,6 +193,10 @@ namespace Echoion::Core
|
||||
// DB persistence. Owned by Core, provided as a service.
|
||||
Void::EventBus::EventBus eventBus_{Void::EventBus::Mode::Async};
|
||||
|
||||
// Config holder kept in sync with config_ and provided as a service
|
||||
// (replaces the former ConfigManager singleton).
|
||||
Api::ConfigManager configManager_;
|
||||
|
||||
public:
|
||||
|
||||
// Access the service registry (composition root).
|
||||
|
||||
Reference in new issue
Block a user