rowt/src/main.rs

36 lines
797 B
Rust

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 mut connection_options = SqliteConnectOptions::from_str("sqlite://db.sqlite").unwrap();
connection_options.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
}