diff --git a/backend/Cargo.toml b/backend/Cargo.toml index a4a0401..c8df765 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -10,7 +10,7 @@ axum-extra = "0.10.1" axum-macros = "0.5.0" chrono = { version = "0.4.41", features = ["serde"] } serde = "1.0.219" -sqlx = { version = "0.8.6", features = ["sqlite", "runtime-tokio", "uuid", "chrono"] } +sqlx = { version = "0.8.6", features = ["sqlite", "runtime-tokio", "uuid", "chrono", "migrate"] } tokio = { version = "1.47.1", features = ["rt-multi-thread", "tracing"] } tower-http = { version = "0.6.0", features = ["cors"] } tracing = "0.1.41" diff --git a/backend/src/main.rs b/backend/src/main.rs index 635d45d..7088520 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -14,16 +14,12 @@ async fn main() { let pool = database::create_pool(&binding) .await .expect("Failed to create database pool"); - let cors = if std::env::var("RUST_ENV").unwrap_or_default() == "production" { + + sqlx::migrate!().run(&pool).await.expect("Failed t"); + + let cors = if let Ok(domain) = std::env::var("CAPTAINS_LOG_URL") { CorsLayer::new() - .allow_origin([ - "https://tiramisu.one" - .parse::() - .unwrap(), - "https://*.tiramisu.one" - .parse::() - .unwrap(), - ]) + .allow_origin([domain.parse::().unwrap()]) .allow_methods(Any) .allow_headers(Any) } else { diff --git a/frontend/package.json b/frontend/package.json index 058687d..a0c2abe 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -5,7 +5,7 @@ "scripts": { "build": "react-router build", "dev": "react-router dev", - "start": "PORT=5173 react-router-serve ./build/server/index.js", + "start": "react-router-serve ./build/server/index.js", "test": "vitest", "test:coverage": "vitest --coverage", "test:run": "vitest run",