Update dependencies (#30)
Rust Build / Test Suite (push) Failing after 58s
Rust Build / Rustfmt (push) Successful in 27s
Rust Build / Check (push) Successful in 2m7s
Rust Build / Clippy (push) Successful in 1m21s
Rust Build / build (push) Successful in 3m5s
textsender_api PR / Rustfmt (pull_request) Successful in 2m0s
textsender_api PR / Check (pull_request) Successful in 2m2s
textsender_api PR / Clippy (pull_request) Successful in 2m37s

Reviewed-on: phoenix/textsender_api#30
This commit was merged in pull request #30.
This commit is contained in:
2026-07-04 21:07:30 -04:00
parent ba485261da
commit 23f9a1430a
6 changed files with 63 additions and 469 deletions
+1 -3
View File
@@ -36,9 +36,7 @@ pub async fn auth<B>(
(StatusCode::UNAUTHORIZED, Json(json_error))
})?;
let secret_key = textsender_models::envy::environment::get_secret_main_key()
.await
.value;
let secret_key = textsender_models::envy::environment::get_secret_main_key().value;
let mut validation = Validation::new(jsonwebtoken::Algorithm::HS256);
validation.set_audience(&["textsender"]); // Must match exactly what's in the token
+22 -17
View File
@@ -81,18 +81,17 @@ pub mod endpoint {
match message_repo::get(&pool, &payload.message_id).await {
Ok(message) => {
println!("Valid message");
let t_config =
match textsender_models::config::auxiliary::load_config().await {
Ok(config) => config,
Err(err) => {
eprintln!("Error: {err:?}");
response.message = String::from("Error getting config");
return (
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
);
}
};
let t_config = match textsender_models::config::auxiliary::load_config() {
Ok(config) => config,
Err(err) => {
eprintln!("Error: {err:?}");
response.message = String::from("Error getting config");
return (
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
axum::Json(response),
);
}
};
let mut results: Vec<
textsender_models::message::event::MessageEventResponse,
> = Vec::new();
@@ -101,12 +100,18 @@ pub mod endpoint {
schedule_at: None,
};
let mut sendmsg = swoosh::SendMsg::default();
sendmsg.load_config(
&t_config.auth_token,
&t_config.phone_number,
&t_config.service_sid,
&t_config.account_sid,
);
for contact in &contacts {
match swoosh::twilio::api::send_message(
&message, contact, &pp, &t_config,
)
.await
{
sendmsg.load_message(&message.content);
sendmsg.load_recipient(&contact.phone_number);
match sendmsg.send_message(&pp).await {
Ok(result) => {
let val = swoosh::twilio::api::response_to_json(result).await;
let mer = textsender_models::message::event::MessageEventResponse {
+1 -1
View File
@@ -50,7 +50,7 @@ pub mod init {
Ok("production") => {
// In production, allow only your specific, trusted origins
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) {
Ok(alwd) => {
let allowed_origins: Vec<axum::http::HeaderValue> = alwd
+1 -3
View File
@@ -5,9 +5,7 @@ pub mod connection_settings {
}
pub async fn create_pool() -> Result<sqlx::PgPool, sqlx::Error> {
let database_url = textsender_models::envy::environment::get_db_url()
.await
.value;
let database_url = textsender_models::envy::environment::get_db_url().value;
println!("Database url: {database_url}");
PgPoolOptions::new()