diff --git a/services/tunnelbroker/src/notifications/config.rs b/services/tunnelbroker/src/notifications/config.rs new file mode 100644 index 000000000..f0ae9684e --- /dev/null +++ b/services/tunnelbroker/src/notifications/config.rs @@ -0,0 +1,8 @@ +#[derive(Default, Clone)] +pub struct Config { + pub fcm_api_key: String, + pub apns_certificate_path: String, + pub apns_certificate_password: String, + pub apns_topic: String, + pub is_sandbox: bool, +} diff --git a/services/tunnelbroker/src/notifications/mod.rs b/services/tunnelbroker/src/notifications/mod.rs index a2c085121..f800aba0a 100644 --- a/services/tunnelbroker/src/notifications/mod.rs +++ b/services/tunnelbroker/src/notifications/mod.rs @@ -1,2 +1,23 @@ pub mod apns; +pub mod config; pub mod fcm; +use super::cxx_bridge::ffi::{getConfigParameter, isSandbox}; +use lazy_static::lazy_static; + +lazy_static! { + static ref CONFIG: config::Config = config::Config { + fcm_api_key: getConfigParameter("notifications.fcm_server_key") + .expect("Error getting `notifications.fcm_server_key` config parameter"), + apns_certificate_path: getConfigParameter("notifications.apns_cert_path") + .expect("Error getting `notifications.apns_cert_path` config parameter"), + apns_certificate_password: getConfigParameter( + "notifications.apns_cert_password" + ) + .expect( + "Error getting `notifications.apns_cert_password` config parameter" + ), + apns_topic: getConfigParameter("notifications.apns_topic") + .expect("Error getting `apns_topic` config parameter"), + is_sandbox: isSandbox().expect("Error determining of sandboxing"), + }; +}