1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-08-09 04:22:45 +03:00

Make the SiteConfig available in the GraphQL context

This commit is contained in:
Quentin Gliech
2024-03-29 13:24:32 +01:00
parent aa2e2229bc
commit e080932906
4 changed files with 22 additions and 3 deletions

View File

@@ -193,6 +193,7 @@ impl TestState {
pool: pool.clone(),
policy_factory: Arc::clone(&policy_factory),
homeserver_connection: Arc::clone(&homeserver_connection),
site_config: site_config.clone(),
rng: Arc::clone(&rng),
clock: Arc::clone(&clock),
};
@@ -307,6 +308,7 @@ impl TestState {
struct TestGraphQLState {
pool: PgPool,
homeserver_connection: Arc<MockHomeserverConnection>,
site_config: SiteConfig,
policy_factory: Arc<PolicyFactory>,
clock: Arc<MockClock>,
rng: Arc<Mutex<ChaChaRng>>,
@@ -336,6 +338,10 @@ impl mas_graphql::State for TestGraphQLState {
Box::new(self.clock.clone())
}
fn site_config(&self) -> &SiteConfig {
&self.site_config
}
fn rng(&self) -> BoxRng {
let mut parent_rng = self.rng.lock().expect("Failed to lock RNG");
let rng = ChaChaRng::from_rng(&mut *parent_rng).expect("Failed to seed RNG");