1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-29 22:01:14 +03:00

Split the core crate

This commit is contained in:
Quentin Gliech
2021-12-17 18:04:30 +01:00
parent ceb17d3646
commit 2f97ca685d
45 changed files with 418 additions and 408 deletions

View File

@ -20,6 +20,7 @@ warp = "0.3.2"
url = "2.2.2"
argon2 = { version = "0.3.2", features = ["password-hash"] }
reqwest = { version = "0.11.7", features = ["rustls-tls"], default-features = false, optional = true }
watchman_client = "0.7.1"
tracing = "0.1.29"
tracing-subscriber = { version = "0.3.3", features = ["env-filter"] }
@ -32,17 +33,18 @@ opentelemetry-otlp = { version = "0.9.0", features = ["trace", "metrics"], optio
opentelemetry-zipkin = { version = "0.14.0", features = ["reqwest-client", "reqwest-rustls"], default-features = false, optional = true }
mas-config = { path = "../config" }
mas-core = { path = "../core" }
mas-handlers = { path = "../handlers" }
mas-templates = { path = "../templates" }
mas-storage = { path = "../storage" }
watchman_client = "0.7.1"
mas-tasks = { path = "../tasks" }
mas-warp-utils = { path = "../warp-utils" }
[dev-dependencies]
indoc = "1.0.3"
[features]
default = ["otlp", "jaeger", "zipkin"]
dev = ["mas-templates/dev", "mas-core/dev"]
dev = ["mas-templates/dev", "mas-handlers/dev"]
# Enable OpenTelemetry OTLP exporter. Requires "protoc"
otlp = ["opentelemetry-otlp"]
# Enable OpenTelemetry Jaeger exporter and propagator.

View File

@ -22,8 +22,8 @@ use clap::Parser;
use futures::{future::TryFutureExt, stream::TryStreamExt};
use hyper::{header, Server, Version};
use mas_config::RootConfig;
use mas_core::tasks::{self, TaskQueue};
use mas_storage::MIGRATOR;
use mas_tasks::TaskQueue;
use mas_templates::Templates;
use opentelemetry_http::HeaderExtractor;
use tower::{make::Shared, ServiceBuilder};
@ -233,7 +233,7 @@ impl ServerCommand {
info!("Starting task scheduler");
let queue = TaskQueue::default();
queue.recuring(Duration::from_secs(15), tasks::cleanup_expired(&pool));
queue.recuring(Duration::from_secs(15), mas_tasks::cleanup_expired(&pool));
queue.start();
// Load and compile the templates
@ -254,7 +254,7 @@ impl ServerCommand {
}
// Start the server
let root = mas_core::handlers::root(&pool, &templates, &config);
let root = mas_handlers::root(&pool, &templates, &config);
let warp_service = warp::service(root);

View File

@ -40,7 +40,7 @@ pub fn setup(config: &TelemetryConfig) -> anyhow::Result<Option<Tracer>> {
// The CORS filter needs to know what headers it should whitelist for
// CORS-protected requests.
mas_core::set_propagator(&propagator);
mas_warp_utils::filters::cors::set_propagator(&propagator);
global::set_text_map_propagator(propagator);
let tracer = tracer(&config.tracing.exporter)?;