Updated main
This commit is contained in:
parent
d059f5e447
commit
b6bceb3ff8
|
@ -1,7 +1,6 @@
|
||||||
use actix_web::{get, web, App, HttpResponse, HttpServer};
|
use actix_web::{get, web, App, HttpResponse, HttpServer};
|
||||||
use rust_embed::RustEmbed;
|
use rust_embed::RustEmbed;
|
||||||
use sea_orm::{Database, DatabaseConnection};
|
use sea_orm::{Database, DatabaseConnection};
|
||||||
use sqlx::SqliteConnection;
|
|
||||||
use tracing::{info, instrument};
|
use tracing::{info, instrument};
|
||||||
use tracing_subscriber::prelude::*;
|
use tracing_subscriber::prelude::*;
|
||||||
|
|
||||||
|
@ -10,9 +9,10 @@ mod auth;
|
||||||
mod entity;
|
mod entity;
|
||||||
mod error;
|
mod error;
|
||||||
|
|
||||||
// Use Jemalloc only for musl-64 bits platforms
|
|
||||||
#[cfg(all(target_env = "musl", target_pointer_width = "64"))]
|
#[cfg(all(target_env = "musl", target_pointer_width = "64"))]
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
|
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct AppState {
|
pub struct AppState {
|
||||||
pub db: DatabaseConnection,
|
pub db: DatabaseConnection,
|
||||||
|
@ -69,7 +69,7 @@ async fn dist(path: web::Path<String>) -> HttpResponse {
|
||||||
.body(body)
|
.body(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
use sqlx::Connection;
|
#[instrument]
|
||||||
async fn setup_database() -> error::Result<DatabaseConnection> {
|
async fn setup_database() -> error::Result<DatabaseConnection> {
|
||||||
let pool = sqlx::SqlitePool::connect("sqlite://data.db").await?;
|
let pool = sqlx::SqlitePool::connect("sqlite://data.db").await?;
|
||||||
sqlx::migrate!("./migrations").run(&pool).await?;
|
sqlx::migrate!("./migrations").run(&pool).await?;
|
||||||
|
|
Loading…
Reference in New Issue