summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2022-07-14 09:17:16 +0200
committerpennae <github@quasiparticle.net>2022-07-14 09:17:16 +0200
commit062cd0ff0176f1f9924e3ae89c0eaf01a8d6fd04 (patch)
treec9d0409c5ec2aa60edad4ee590b746cb645208e7 /src
parent566d6ccee21fc52943cf1862222f2e9a8927403c (diff)
downloadminor-skulk-062cd0ff0176f1f9924e3ae89c0eaf01a8d6fd04.tar.gz
minor-skulk-062cd0ff0176f1f9924e3ae89c0eaf01a8d6fd04.tar.xz
minor-skulk-062cd0ff0176f1f9924e3ae89c0eaf01a8d6fd04.zip
allow integration tests to run in parallel
this doesn't do much for performance, but it does allow running the tests with a simple `cargo t`.
Diffstat (limited to 'src')
-rw-r--r--src/bin/minorskulk.rs2
-rw-r--r--src/lib.rs9
2 files changed, 5 insertions, 6 deletions
diff --git a/src/bin/minorskulk.rs b/src/bin/minorskulk.rs
index 1609edb..21665a9 100644
--- a/src/bin/minorskulk.rs
+++ b/src/bin/minorskulk.rs
@@ -4,6 +4,6 @@ use minor_skulk::build;
async fn main() -> anyhow::Result<()> {
dotenv::dotenv().ok();
- let _ = build().await?.launch().await?;
+ let _ = build(rocket::build()).await?.launch().await?;
Ok(())
}
diff --git a/src/lib.rs b/src/lib.rs
index 1e6fa31..75232ee 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -54,7 +54,7 @@ fn default_task_interval() -> std::time::Duration {
std::time::Duration::from_secs(5 * 60)
}
-#[derive(serde::Deserialize)]
+#[derive(Debug, serde::Deserialize)]
struct Config {
database_url: String,
location: Absolute<'static>,
@@ -203,9 +203,8 @@ async fn ensure_invite_admin(db: &Db, cfg: &Config) -> anyhow::Result<()> {
}
}
-pub async fn build() -> anyhow::Result<rocket::Rocket<rocket::Build>> {
- let rocket = rocket::build();
- let config = rocket.figment().extract::<Config>().context("reading config")?;
+pub async fn build(base: rocket::Rocket<rocket::Build>) -> anyhow::Result<rocket::Rocket<rocket::Build>> {
+ let config = base.figment().extract::<Config>().context("reading config")?;
let db = Arc::new(Db::connect(&config.database_url).await.unwrap());
db.migrate().await.context("running db migrations")?;
@@ -245,7 +244,7 @@ pub async fn build() -> anyhow::Result<rocket::Rocket<rocket::Build>> {
Ok(())
}
});
- let rocket = rocket
+ let rocket = base
.manage(config)
.manage(push)
.manage(mailer)