Adding function to load twilio config
textsender_models PR / Rustfmt (pull_request) Successful in 1m2s
textsender_models PR / Check (pull_request) Successful in 1m10s
textsender_models PR / Clippy (pull_request) Successful in 1m25s
Release Tagging / release (pull_request) Successful in 37s

This commit is contained in:
2026-06-21 17:57:02 -04:00
parent 7e5bc016b1
commit 720f3d8f75
2 changed files with 25 additions and 0 deletions
+23
View File
@@ -19,3 +19,26 @@ impl TwilioConfig {
println!("Number: {:?}", self.phone_number);
}
}
// TODO: Remove the async at a later point
pub async fn load_config() -> Result<TwilioConfig, std::io::Error> {
let auth_sid_var = crate::envy::environment::get_env("TWILIO_AUTH_SID").await;
let service_sid_var = crate::envy::environment::get_env("TWILIO_SERVICE_SID").await;
let auth_token_var = crate::envy::environment::get_env("TWILIO_AUTH_TOKEN").await;
let phone_number_var = crate::envy::environment::get_env("TWILIO_PHONE_NUMBER").await;
if auth_sid_var.value.is_empty()
|| service_sid_var.value.is_empty()
|| auth_token_var.value.is_empty()
|| phone_number_var.value.is_empty()
{
Err(std::io::Error::other("Config not set"))
} else {
Ok(TwilioConfig {
service_sid: service_sid_var.value,
auth_token: auth_token_var.value,
account_sid: auth_sid_var.value,
phone_number: phone_number_var.value,
})
}
}