Making changes related to breaking changes
This commit is contained in:
+1
-3
@@ -36,9 +36,7 @@ pub async fn auth<B>(
|
|||||||
(StatusCode::UNAUTHORIZED, Json(json_error))
|
(StatusCode::UNAUTHORIZED, Json(json_error))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let secret_key = textsender_models::envy::environment::get_secret_main_key()
|
let secret_key = textsender_models::envy::environment::get_secret_main_key().value;
|
||||||
.await
|
|
||||||
.value;
|
|
||||||
|
|
||||||
let mut validation = Validation::new(jsonwebtoken::Algorithm::HS256);
|
let mut validation = Validation::new(jsonwebtoken::Algorithm::HS256);
|
||||||
validation.set_audience(&["textsender"]); // Must match exactly what's in the token
|
validation.set_audience(&["textsender"]); // Must match exactly what's in the token
|
||||||
|
|||||||
+11
-12
@@ -81,18 +81,17 @@ pub mod endpoint {
|
|||||||
match message_repo::get(&pool, &payload.message_id).await {
|
match message_repo::get(&pool, &payload.message_id).await {
|
||||||
Ok(message) => {
|
Ok(message) => {
|
||||||
println!("Valid message");
|
println!("Valid message");
|
||||||
let t_config =
|
let t_config = match textsender_models::config::auxiliary::load_config() {
|
||||||
match textsender_models::config::auxiliary::load_config().await {
|
Ok(config) => config,
|
||||||
Ok(config) => config,
|
Err(err) => {
|
||||||
Err(err) => {
|
eprintln!("Error: {err:?}");
|
||||||
eprintln!("Error: {err:?}");
|
response.message = String::from("Error getting config");
|
||||||
response.message = String::from("Error getting config");
|
return (
|
||||||
return (
|
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
axum::Json(response),
|
||||||
axum::Json(response),
|
);
|
||||||
);
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
let mut results: Vec<
|
let mut results: Vec<
|
||||||
textsender_models::message::event::MessageEventResponse,
|
textsender_models::message::event::MessageEventResponse,
|
||||||
> = Vec::new();
|
> = Vec::new();
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ pub mod init {
|
|||||||
Ok("production") => {
|
Ok("production") => {
|
||||||
// In production, allow only your specific, trusted origins
|
// In production, allow only your specific, trusted origins
|
||||||
let allowed_origins_env =
|
let allowed_origins_env =
|
||||||
textsender_models::envy::environment::get_allowed_origins().await;
|
textsender_models::envy::environment::get_allowed_origins();
|
||||||
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
|
||||||
|
|||||||
+1
-3
@@ -5,9 +5,7 @@ pub mod connection_settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn create_pool() -> Result<sqlx::PgPool, sqlx::Error> {
|
pub async fn create_pool() -> Result<sqlx::PgPool, sqlx::Error> {
|
||||||
let database_url = textsender_models::envy::environment::get_db_url()
|
let database_url = textsender_models::envy::environment::get_db_url().value;
|
||||||
.await
|
|
||||||
.value;
|
|
||||||
println!("Database url: {database_url}");
|
println!("Database url: {database_url}");
|
||||||
|
|
||||||
PgPoolOptions::new()
|
PgPoolOptions::new()
|
||||||
|
|||||||
Reference in New Issue
Block a user