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

Serve static files live from disk in dev mode

This commit is contained in:
Quentin Gliech
2022-04-28 16:08:28 +02:00
parent 8044d0a41b
commit 8a256596d7
17 changed files with 258 additions and 193 deletions

View File

@ -6,7 +6,7 @@ edition = "2021"
license = "Apache-2.0"
[dependencies]
tokio = { version = "1.17.0", features = ["full"] }
tokio = { version = "1.18.0", features = ["full"] }
futures = "0.3.21"
anyhow = "1.0.57"
clap = { version = "3.1.12", features = ["derive"] }
@ -32,21 +32,22 @@ opentelemetry-jaeger = { version = "0.16.0", features = ["rt-tokio", "reqwest_co
opentelemetry-otlp = { version = "0.10.0", features = ["trace", "metrics"], optional = true }
opentelemetry-zipkin = { version = "0.15.0", features = ["reqwest-client", "reqwest-rustls"], default-features = false, optional = true }
mas-axum-utils = { path = "../axum-utils" }
mas-config = { path = "../config" }
mas-email = { path = "../email" }
mas-handlers = { path = "../handlers" }
mas-http = { path = "../http" }
mas-static-files = { path = "../static-files" }
mas-storage = { path = "../storage" }
mas-tasks = { path = "../tasks" }
mas-templates = { path = "../templates" }
mas-axum-utils = { path = "../axum-utils" }
[dev-dependencies]
indoc = "1.0.4"
[features]
default = ["otlp", "jaeger", "zipkin"]
dev = ["mas-templates/dev", "mas-handlers/dev"]
dev = ["mas-templates/dev", "mas-static-files/dev"]
# Enable OpenTelemetry OTLP exporter. Requires "protoc"
otlp = ["opentelemetry-otlp"]
# Enable OpenTelemetry Jaeger exporter and propagator.

View File

@ -194,6 +194,8 @@ impl Options {
let url_builder = UrlBuilder::new(config.http.public_base.clone());
let static_files = mas_static_files::service(&config.http.web_root);
// Explicitely the config to properly zeroize secret keys
drop(config);
@ -217,6 +219,7 @@ impl Options {
&mailer,
&url_builder,
)
.fallback(static_files)
.layer(ServerLayer::default());
info!("Listening on http://{}", listener.local_addr().unwrap());