Update rust (#8)
sender pr / Check (pull_request) Failing after 13s
sender pr / Rustfmt (pull_request) Successful in 1m10s
sender pr / Clippy (pull_request) Successful in 3m42s
sender Build / Check (push) Successful in 1m39s
sender Build / Rustfmt (push) Successful in 1m19s
sender Build / Test Suite (push) Successful in 2m3s
sender Build / Clippy (push) Successful in 2m10s
sender Build / build (push) Successful in 2m53s
sender pr / Check (pull_request) Failing after 13s
sender pr / Rustfmt (pull_request) Successful in 1m10s
sender pr / Clippy (pull_request) Successful in 3m42s
sender Build / Check (push) Successful in 1m39s
sender Build / Rustfmt (push) Successful in 1m19s
sender Build / Test Suite (push) Successful in 2m3s
sender Build / Clippy (push) Successful in 2m10s
sender Build / build (push) Successful in 2m53s
Reviewed-on: #8
This commit was merged in pull request #8.
This commit is contained in:
+6
-6
@@ -20,14 +20,14 @@ fn path_exists(path: &str) -> bool {
|
||||
file.exists()
|
||||
}
|
||||
|
||||
pub async fn parse_config() -> (textsender_models::config::auxiliary::TwilioConfig, bool) {
|
||||
pub fn parse_config() -> (textsender_models::config::auxiliary::TwilioConfig, bool) {
|
||||
let mut config = textsender_models::config::auxiliary::TwilioConfig {
|
||||
..Default::default()
|
||||
};
|
||||
let auth_sid_var = textsender_models::envy::environment::get_env("AUTH_SID").await;
|
||||
let auth_token_var = textsender_models::envy::environment::get_env("AUTH_TOKEN").await;
|
||||
let phone_number_var = textsender_models::envy::environment::get_env("PHONE_NUMBER").await;
|
||||
let service_sid_var = textsender_models::envy::environment::get_env("SERVICE_SID").await;
|
||||
let auth_sid_var = textsender_models::envy::environment::get_env("AUTH_SID");
|
||||
let auth_token_var = textsender_models::envy::environment::get_env("AUTH_TOKEN");
|
||||
let phone_number_var = textsender_models::envy::environment::get_env("PHONE_NUMBER");
|
||||
let service_sid_var = textsender_models::envy::environment::get_env("SERVICE_SID");
|
||||
config.account_sid = auth_sid_var.value;
|
||||
config.auth_token = auth_token_var.value;
|
||||
config.phone_number = phone_number_var.value;
|
||||
@@ -46,7 +46,7 @@ pub async fn parse_config() -> (textsender_models::config::auxiliary::TwilioConf
|
||||
mod tests {
|
||||
#[test]
|
||||
fn test_parse_config() {
|
||||
let (config, success) = async_std::task::block_on(super::parse_config());
|
||||
let (config, success) = super::parse_config();
|
||||
assert!(success, "Config was not parsed");
|
||||
assert_eq!(
|
||||
false,
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ async fn main() {
|
||||
println!("Message path: {m_path:?}");
|
||||
println!("Phone Number path: {n_path:?}");
|
||||
|
||||
let (config, success) = config::parse_config().await;
|
||||
let (config, success) = config::parse_config();
|
||||
if !success {
|
||||
eprintln!("Error parsing config");
|
||||
} else {
|
||||
|
||||
+10
-1
@@ -16,7 +16,16 @@ pub async fn send_messages(
|
||||
schedule: false,
|
||||
schedule_at: None,
|
||||
};
|
||||
match swoosh::twilio::api::send_mssage(message, contact, param, config).await {
|
||||
let mut sendmsg = swoosh::SendMsg::default();
|
||||
sendmsg.load_config(
|
||||
&config.auth_token,
|
||||
&config.phone_number,
|
||||
&config.service_sid,
|
||||
&config.account_sid,
|
||||
);
|
||||
sendmsg.load_recipient(&contact.phone_number);
|
||||
sendmsg.load_message(&message.content);
|
||||
match sendmsg.send_message(¶m).await {
|
||||
Ok(response) => {
|
||||
println!("Raw response: {response:?}");
|
||||
let val = swoosh::twilio::api::response_to_json(response).await;
|
||||
|
||||
Reference in New Issue
Block a user