deployment-tweaks (#17)
Reviewed-on: #17 Co-authored-by: Drew Galbraith <drew@tiramisu.one> Co-committed-by: Drew Galbraith <drew@tiramisu.one>
This commit is contained in:
parent
25eb4af14d
commit
ef609f748d
3 changed files with 7 additions and 11 deletions
|
|
@ -10,7 +10,7 @@ axum-extra = "0.10.1"
|
||||||
axum-macros = "0.5.0"
|
axum-macros = "0.5.0"
|
||||||
chrono = { version = "0.4.41", features = ["serde"] }
|
chrono = { version = "0.4.41", features = ["serde"] }
|
||||||
serde = "1.0.219"
|
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"] }
|
tokio = { version = "1.47.1", features = ["rt-multi-thread", "tracing"] }
|
||||||
tower-http = { version = "0.6.0", features = ["cors"] }
|
tower-http = { version = "0.6.0", features = ["cors"] }
|
||||||
tracing = "0.1.41"
|
tracing = "0.1.41"
|
||||||
|
|
|
||||||
|
|
@ -14,16 +14,12 @@ async fn main() {
|
||||||
let pool = database::create_pool(&binding)
|
let pool = database::create_pool(&binding)
|
||||||
.await
|
.await
|
||||||
.expect("Failed to create database pool");
|
.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()
|
CorsLayer::new()
|
||||||
.allow_origin([
|
.allow_origin([domain.parse::<axum::http::HeaderValue>().unwrap()])
|
||||||
"https://tiramisu.one"
|
|
||||||
.parse::<axum::http::HeaderValue>()
|
|
||||||
.unwrap(),
|
|
||||||
"https://*.tiramisu.one"
|
|
||||||
.parse::<axum::http::HeaderValue>()
|
|
||||||
.unwrap(),
|
|
||||||
])
|
|
||||||
.allow_methods(Any)
|
.allow_methods(Any)
|
||||||
.allow_headers(Any)
|
.allow_headers(Any)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "react-router build",
|
"build": "react-router build",
|
||||||
"dev": "react-router dev",
|
"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": "vitest",
|
||||||
"test:coverage": "vitest --coverage",
|
"test:coverage": "vitest --coverage",
|
||||||
"test:run": "vitest run",
|
"test:run": "vitest run",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue