Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/target
/data
*.db
.env
.env
.vscode
7 changes: 4 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![forbid(unsafe_code)]
#![warn(clippy::all, clippy::pedantic)]

// Import modules
Comment thread
At-Heal marked this conversation as resolved.
mod encryption;
mod models;
mod routes;
Expand Down Expand Up @@ -43,14 +44,14 @@ async fn main() -> Result<()> {
warn!("Lumen is running in debug mode. This is not recommended for production use.");
}

let storage = Storage::new("data").await?;
let storage = Storage::new("data").await?; // Create a new instance of the Storage struct
Comment thread
At-Heal marked this conversation as resolved.
let pool = SqlitePoolOptions::new()
.connect_with(
SqliteConnectOptions::new()
.filename("data/lumen.db")
.create_if_missing(true),
)
.await?;
.await?; // Create a new connection pool to the SQLite database
Comment thread
At-Heal marked this conversation as resolved.

let config = ConfigCache {
public_url: std::env::var("PUBLIC_URL").expect("PUBLIC_URL not set in environment"),
Expand All @@ -59,7 +60,7 @@ async fn main() -> Result<()> {
info!("Running migrations...");

// todo: support other databases (mysql, postgresql, etc)
sqlx::migrate!().run(&pool).await?;
sqlx::migrate!().run(&pool).await?; // Run database migrations
let data = Data::new(AppData { pool, storage, config });

let bind = std::env::var("BIND").expect("BIND not set in environment");
Expand Down