convert Client into Service
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
f465d77ad3
commit
8a2ae401df
13 changed files with 159 additions and 23 deletions
|
@ -1,4 +1,3 @@
|
|||
mod client;
|
||||
mod data;
|
||||
mod emerg_access;
|
||||
pub(super) mod migrations;
|
||||
|
@ -24,7 +23,7 @@ use ruma::{
|
|||
use tokio::sync::Mutex;
|
||||
use url::Url;
|
||||
|
||||
use crate::{resolver, service, services};
|
||||
use crate::{service, services};
|
||||
|
||||
pub struct Service {
|
||||
pub db: Data,
|
||||
|
@ -33,7 +32,6 @@ pub struct Service {
|
|||
pub cidr_range_denylist: Vec<IPAddress>,
|
||||
keypair: Arc<ruma::signatures::Ed25519KeyPair>,
|
||||
jwt_decoding_key: Option<jsonwebtoken::DecodingKey>,
|
||||
pub client: client::Client,
|
||||
pub stable_room_versions: Vec<RoomVersionId>,
|
||||
pub unstable_room_versions: Vec<RoomVersionId>,
|
||||
pub bad_event_ratelimiter: Arc<RwLock<HashMap<OwnedEventId, RateLimitState>>>,
|
||||
|
@ -85,15 +83,11 @@ impl crate::Service for Service {
|
|||
cidr_range_denylist.push(cidr);
|
||||
}
|
||||
|
||||
let resolver = service::get::<resolver::Service>(args.service, "resolver")
|
||||
.expect("resolver must be built prior to globals");
|
||||
|
||||
let mut s = Self {
|
||||
db,
|
||||
config: config.clone(),
|
||||
cidr_range_denylist,
|
||||
keypair: Arc::new(keypair),
|
||||
client: client::Client::new(config, &resolver),
|
||||
jwt_decoding_key,
|
||||
stable_room_versions,
|
||||
unstable_room_versions,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue