Saving changes
Rust Build / Rustfmt (pull_request) Successful in 40s
Rust Build / Test Suite (pull_request) Failing after 1m39s
Rust Build / Clippy (pull_request) Failing after 1m20s
Rust Build / Check (pull_request) Failing after 2m28s
Rust Build / build (pull_request) Failing after 1m59s
Rust Build / Rustfmt (pull_request) Successful in 40s
Rust Build / Test Suite (pull_request) Failing after 1m39s
Rust Build / Clippy (pull_request) Failing after 1m20s
Rust Build / Check (pull_request) Failing after 2m28s
Rust Build / build (pull_request) Failing after 1m59s
This commit is contained in:
+29
-29
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
pub mod host {
|
pub mod host {
|
||||||
pub const PORT: i64 = 9081;
|
pub const PORT: i64 = 9081;
|
||||||
|
|
||||||
@@ -10,27 +9,27 @@ pub mod host {
|
|||||||
pub mod init {
|
pub mod init {
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use axum::routing::{delete, get, patch, post};
|
use axum::routing::{delete, get, patch, post};
|
||||||
use tower_http::timeout::TimeoutLayer;
|
use tower_http::timeout::TimeoutLayer;
|
||||||
use utoipa::OpenApi;
|
use utoipa::OpenApi;
|
||||||
|
|
||||||
use crate::callers::coverart as coverart_caller;
|
use crate::callers::coverart as coverart_caller;
|
||||||
use crate::callers::queue::coverart as coverart_queue_callers;
|
use crate::callers::queue::coverart as coverart_queue_callers;
|
||||||
use crate::callers::queue::metadata as metadata_queue_caller;
|
use crate::callers::queue::metadata as metadata_queue_caller;
|
||||||
use crate::callers::queue::song as song_queue_callers;
|
use crate::callers::queue::song as song_queue_callers;
|
||||||
use crate::callers::song as song_caller;
|
use crate::callers::song as song_caller;
|
||||||
use coverart_caller::endpoint as coverart_endpoints;
|
use coverart_caller::endpoint as coverart_endpoints;
|
||||||
use coverart_caller::response as coverart_responses;
|
use coverart_caller::response as coverart_responses;
|
||||||
use coverart_queue_callers::endpoint as coverart_queue_endpoints;
|
use coverart_queue_callers::endpoint as coverart_queue_endpoints;
|
||||||
use coverart_queue_callers::response as coverart_queue_responses;
|
use coverart_queue_callers::response as coverart_queue_responses;
|
||||||
use metadata_queue_caller::endpoint as metadata_queue_endpoints;
|
use metadata_queue_caller::endpoint as metadata_queue_endpoints;
|
||||||
use metadata_queue_caller::response as metadata_queue_responses;
|
use metadata_queue_caller::response as metadata_queue_responses;
|
||||||
use song_caller::endpoint as song_endpoints;
|
use song_caller::endpoint as song_endpoints;
|
||||||
use song_caller::response as song_responses;
|
use song_caller::response as song_responses;
|
||||||
use song_queue_callers::endpoint as song_queue_endpoints;
|
use song_queue_callers::endpoint as song_queue_endpoints;
|
||||||
use song_queue_callers::response as song_queue_responses;
|
use song_queue_callers::response as song_queue_responses;
|
||||||
|
|
||||||
mod cors {
|
mod cors {
|
||||||
pub async fn configure_cors() -> tower_http::cors::CorsLayer {
|
pub async fn configure_cors() -> tower_http::cors::CorsLayer {
|
||||||
let cors = tower_http::cors::CorsLayer::new()
|
let cors = tower_http::cors::CorsLayer::new()
|
||||||
.allow_methods([
|
.allow_methods([
|
||||||
@@ -50,7 +49,8 @@ mod cors {
|
|||||||
match std::env::var(textsender_models::envy::keys::APP_ENV).as_deref() {
|
match std::env::var(textsender_models::envy::keys::APP_ENV).as_deref() {
|
||||||
Ok("production") => {
|
Ok("production") => {
|
||||||
// In production, allow only your specific, trusted origins
|
// In production, allow only your specific, trusted origins
|
||||||
let allowed_origins_env = textsender_models::envy::environment::get_allowed_origins().await;
|
let allowed_origins_env =
|
||||||
|
textsender_models::envy::environment::get_allowed_origins().await;
|
||||||
match textsender_models::envy::utility::delimitize(&allowed_origins_env) {
|
match textsender_models::envy::utility::delimitize(&allowed_origins_env) {
|
||||||
Ok(alwd) => {
|
Ok(alwd) => {
|
||||||
let allowed_origins: Vec<axum::http::HeaderValue> = alwd
|
let allowed_origins: Vec<axum::http::HeaderValue> = alwd
|
||||||
@@ -76,19 +76,19 @@ mod cors {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(utoipa::OpenApi)]
|
#[derive(utoipa::OpenApi)]
|
||||||
#[openapi(
|
#[openapi(
|
||||||
paths(song_queue_endpoints::queue_song,),
|
paths(song_queue_endpoints::queue_song,),
|
||||||
components(schemas(song_queue_callers::response::song_queue::Response)),
|
components(schemas(song_queue_callers::response::song_queue::Response)),
|
||||||
tags(
|
tags(
|
||||||
(name = "textsender API", description = "Web API to manage texting")
|
(name = "textsender API", description = "Web API to manage texting")
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
struct ApiDoc;
|
struct ApiDoc;
|
||||||
|
|
||||||
pub async fn routes() -> axum::Router {
|
pub async fn routes() -> axum::Router {
|
||||||
axum::Router::new()
|
axum::Router::new()
|
||||||
.route(
|
.route(
|
||||||
crate::callers::queue::endpoints::QUEUESONG,
|
crate::callers::queue::endpoints::QUEUESONG,
|
||||||
@@ -97,9 +97,9 @@ pub async fn routes() -> axum::Router {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
.layer(cors::configure_cors().await)
|
.layer(cors::configure_cors().await)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn app() -> axum::Router {
|
pub async fn app() -> axum::Router {
|
||||||
let pool = crate::db::create_pool()
|
let pool = crate::db::create_pool()
|
||||||
.await
|
.await
|
||||||
.expect("Failed to create pool");
|
.expect("Failed to create pool");
|
||||||
@@ -121,5 +121,5 @@ pub async fn app() -> axum::Router {
|
|||||||
Duration::from_secs(300),
|
Duration::from_secs(300),
|
||||||
))
|
))
|
||||||
.layer(cors)
|
.layer(cors)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user