2022-08-04 14:08:06 +00:00
|
|
|
use std::env;
|
|
|
|
|
|
|
|
mod identity;
|
2022-08-11 05:34:46 +00:00
|
|
|
mod member;
|
2022-08-08 10:11:55 +00:00
|
|
|
mod site;
|
2022-08-04 14:08:06 +00:00
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
|
|
let url_broker = match env::var_os("URL_BROKER") {
|
|
|
|
Some(v) => v.into_string().unwrap(),
|
|
|
|
None => "".to_string(),
|
|
|
|
};
|
|
|
|
let queue_broker = match env::var_os("QUEUE_BROKER") {
|
|
|
|
Some(v) => v.into_string().unwrap(),
|
|
|
|
None => "".to_string(),
|
|
|
|
};
|
|
|
|
|
|
|
|
let broker_opts = nats::asynk::Options::new();
|
|
|
|
let connection_broker = broker_opts.connect(url_broker).await?;
|
|
|
|
|
2022-08-11 05:34:46 +00:00
|
|
|
let site_service = site::service::Service::new(connection_broker.clone(), queue_broker.clone());
|
2022-08-08 10:11:55 +00:00
|
|
|
let identity_service =
|
|
|
|
identity::service::Service::new(connection_broker.clone(), queue_broker.clone());
|
2022-08-11 05:34:46 +00:00
|
|
|
let member_service =
|
|
|
|
member::service::Service::new(connection_broker.clone(), queue_broker.clone());
|
2022-08-04 14:08:06 +00:00
|
|
|
|
|
|
|
println!("Server edge[beteran-backend-server-edge] is started");
|
|
|
|
|
2022-08-11 05:34:46 +00:00
|
|
|
futures::try_join!(
|
|
|
|
site_service.subscribe(),
|
|
|
|
identity_service.subscribe(),
|
|
|
|
member_service.subscribe()
|
|
|
|
)?;
|
2022-08-04 14:08:06 +00:00
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|