rowt/src/main.rs
philipp e4ef1f1584
Some checks failed
CI/CD Pipeline / test (push) Failing after 4m16s
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
add weather infos
2024-05-16 14:41:15 +02:00

46 lines
1.0 KiB
Rust

#![allow(clippy::blocks_in_conditions)]
use std::str::FromStr;
#[cfg(feature = "rest")]
use rot::rest;
#[cfg(feature = "rowing-tera")]
use rot::tera;
use rot::{scheduled, tera::Config};
use sqlx::{pool::PoolOptions, sqlite::SqliteConnectOptions, ConnectOptions};
#[macro_use]
extern crate rocket;
#[launch]
async fn rocket() -> _ {
use sqlx::SqlitePool;
env_logger::init();
let connection_options = SqliteConnectOptions::from_str("sqlite://db.sqlite")
.unwrap()
.log_statements(log::LevelFilter::Debug);
let db: SqlitePool = PoolOptions::new()
.connect_with(connection_options)
.await
.unwrap();
let rocket = rocket::build().manage(db.clone());
#[cfg(feature = "rowing-tera")]
let rocket = tera::config(rocket);
#[cfg(feature = "rest")]
let rocket = rest::config(rocket);
let config: Config = rocket
.figment()
.extract()
.expect("Config extraction failed");
scheduled::schedule(&db, &config);
rocket
}