summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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)