Update dependencies (#13)
Reviewed-on: #13
This commit was merged in pull request #13.
This commit is contained in:
Generated
+170
-541
File diff suppressed because it is too large
Load Diff
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "catapult"
|
name = "catapult"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
rust-version = "1.96"
|
rust-version = "1.96"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
@@ -10,9 +10,9 @@ futures = { version = "0.3.32" }
|
|||||||
reqwest = { version = "0.13.4", features = ["json", "stream", "multipart"] }
|
reqwest = { version = "0.13.4", features = ["json", "stream", "multipart"] }
|
||||||
serde = { version = "1.0.228", features = ["derive"] }
|
serde = { version = "1.0.228", features = ["derive"] }
|
||||||
serde_json = { version = "1.0.150" }
|
serde_json = { version = "1.0.150" }
|
||||||
time = { version = "0.3.49", features = ["formatting", "macros", "parsing", "serde"] }
|
time = { version = "0.3.53", features = ["formatting", "macros", "parsing", "serde"] }
|
||||||
uuid = { version = "1.23.3", features = ["v4", "serde"] }
|
uuid = { version = "1.23.3", features = ["v4", "serde"] }
|
||||||
textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender_models.git", tag = "v0.4.10" }
|
textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender_models.git", tag = "v0.5.0" }
|
||||||
swoosh = { git = "ssh://git@git.kundeng.us/phoenix/swoosh.git", tag = "v0.4.2.0" }
|
swoosh = { git = "ssh://git@git.kundeng.us/phoenix/swoosh.git", tag = "v0.5.1" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|||||||
+6
-6
@@ -14,12 +14,12 @@ pub struct App {
|
|||||||
|
|
||||||
// TODO: Change this to non-async at some point.
|
// TODO: Change this to non-async at some point.
|
||||||
// Will require changes in other libraries
|
// Will require changes in other libraries
|
||||||
pub async fn load_app() -> Result<App, std::io::Error> {
|
pub fn load_app() -> Result<App, std::io::Error> {
|
||||||
use textsender_models::envy;
|
use textsender_models::envy;
|
||||||
let auth_url_env = envy::environment::get_env("AUTH_URL").await;
|
let auth_url_env = envy::environment::get_env("AUTH_URL");
|
||||||
let api_url_env = envy::environment::get_env("API_URL").await;
|
let api_url_env = envy::environment::get_env("API_URL");
|
||||||
let service_username_env = envy::environment::get_env("SERVICE_USERNAME").await;
|
let service_username_env = envy::environment::get_env("SERVICE_USERNAME");
|
||||||
let service_passphrase_env = envy::environment::get_env("SERVICE_PASSPHRASE").await;
|
let service_passphrase_env = envy::environment::get_env("SERVICE_PASSPHRASE");
|
||||||
|
|
||||||
let envs = vec![
|
let envs = vec![
|
||||||
api_url_env,
|
api_url_env,
|
||||||
@@ -40,7 +40,7 @@ pub async fn load_app() -> Result<App, std::io::Error> {
|
|||||||
let (envs_valid, reason) = check_envs(&envs);
|
let (envs_valid, reason) = check_envs(&envs);
|
||||||
|
|
||||||
if envs_valid {
|
if envs_valid {
|
||||||
match textsender_models::config::auxiliary::load_config().await {
|
match textsender_models::config::auxiliary::load_config() {
|
||||||
Ok(twilio_config) => Ok(App {
|
Ok(twilio_config) => Ok(App {
|
||||||
api_url: envs[0].value.clone(),
|
api_url: envs[0].value.clone(),
|
||||||
auth_url: envs[1].value.clone(),
|
auth_url: envs[1].value.clone(),
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
std::process::exit(-1);
|
std::process::exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
let app = match catapult::app::load_app().await {
|
let app = match catapult::app::load_app() {
|
||||||
Ok(app) => app,
|
Ok(app) => app,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
eprintln!("Error: {err:?}");
|
eprintln!("Error: {err:?}");
|
||||||
|
|||||||
+11
-1
@@ -69,6 +69,14 @@ impl Service {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let events = events.unwrap_or_default();
|
let events = events.unwrap_or_default();
|
||||||
|
let mut sendmsg = swoosh::SendMsg::default();
|
||||||
|
sendmsg.load_config(
|
||||||
|
&self.app.twilio_config.auth_token,
|
||||||
|
&self.app.twilio_config.phone_number,
|
||||||
|
&self.app.twilio_config.service_sid,
|
||||||
|
&self.app.twilio_config.account_sid,
|
||||||
|
);
|
||||||
|
|
||||||
for event in &events {
|
for event in &events {
|
||||||
println!("Event: {event:?}");
|
println!("Event: {event:?}");
|
||||||
let contact = &match contacts.get(&event.contact_id).await {
|
let contact = &match contacts.get(&event.contact_id).await {
|
||||||
@@ -105,8 +113,10 @@ impl Service {
|
|||||||
let twilio_config = &self.app.twilio_config;
|
let twilio_config = &self.app.twilio_config;
|
||||||
println!("Config: {twilio_config:?}");
|
println!("Config: {twilio_config:?}");
|
||||||
println!("SM: {scheduled_message:?}");
|
println!("SM: {scheduled_message:?}");
|
||||||
|
sendmsg.load_message(&message.content);
|
||||||
|
sendmsg.load_recipient(&contact.phone_number);
|
||||||
|
|
||||||
match swoosh::twilio::api::send_message(message, contact, ¶m, twilio_config).await {
|
match sendmsg.send_message(¶m).await {
|
||||||
Ok(resp) => {
|
Ok(resp) => {
|
||||||
println!("Message scheduled");
|
println!("Message scheduled");
|
||||||
// MER response
|
// MER response
|
||||||
|
|||||||
Reference in New Issue
Block a user