mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat: add remote config over http/redis
This commit is contained in:
parent
c4db95796d
commit
a72afb35a0
12 changed files with 326 additions and 4 deletions
|
|
@ -2,7 +2,9 @@
|
|||
#![feature(if_let_guard)]
|
||||
|
||||
use chrono::Timelike;
|
||||
use discord::gateway::cluster_config;
|
||||
use fred::{clients::RedisPool, interfaces::*};
|
||||
use libpk::runtime_config::RuntimeConfig;
|
||||
use signal_hook::{
|
||||
consts::{SIGINT, SIGTERM},
|
||||
iterator::Signals,
|
||||
|
|
@ -28,6 +30,14 @@ async fn real_main() -> anyhow::Result<()> {
|
|||
|
||||
let redis = libpk::db::init_redis().await?;
|
||||
|
||||
let runtime_config = Arc::new(
|
||||
RuntimeConfig::new(
|
||||
redis.clone(),
|
||||
format!("gateway:{}", cluster_config().node_id),
|
||||
)
|
||||
.await?,
|
||||
);
|
||||
|
||||
let shard_state = discord::shard_state::new(redis.clone());
|
||||
let cache = Arc::new(discord::cache::new());
|
||||
|
||||
|
|
@ -57,7 +67,7 @@ async fn real_main() -> anyhow::Result<()> {
|
|||
// todo: probably don't do it this way
|
||||
let api_shutdown_tx = shutdown_tx.clone();
|
||||
set.spawn(tokio::spawn(async move {
|
||||
match cache_api::run_server(cache).await {
|
||||
match cache_api::run_server(cache, runtime_config).await {
|
||||
Err(error) => {
|
||||
tracing::error!(?error, "failed to serve cache api");
|
||||
let _ = api_shutdown_tx.send(());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue