rowt/src/main.rs
philipp 6ed28994c6
Some checks failed
CI/CD Pipeline / test (push) Failing after 15m23s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
code cleanup
2024-02-21 14:46:17 +01:00

39 lines
828 B
Rust

#![allow(clippy::blocks_in_conditions)]
use std::str::FromStr;
#[cfg(feature = "rest")]
use rot::rest;
#[cfg(feature = "rowing-tera")]
use rot::tera;
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);
#[cfg(feature = "rowing-tera")]
let rocket = tera::config(rocket);
#[cfg(feature = "rest")]
let rocket = rest::config(rocket);
rocket
}