Skip to content

Some commenting #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
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
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

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