2022-08-04 14:08:06 +00:00
|
|
|
use std::env;
|
|
|
|
|
2022-08-14 03:13:35 +00:00
|
|
|
mod bank;
|
2022-08-04 14:08:06 +00:00
|
|
|
mod identity;
|
2022-08-11 05:34:46 +00:00
|
|
|
mod member;
|
2022-08-14 03:13:35 +00:00
|
|
|
mod member_bank_account;
|
|
|
|
mod member_bank_deposit;
|
|
|
|
mod member_bank_withdraw;
|
2022-08-12 09:05:00 +00:00
|
|
|
mod member_class;
|
2022-08-22 07:32:24 +00:00
|
|
|
mod member_game_setting;
|
2022-08-12 09:05:00 +00:00
|
|
|
mod member_level;
|
2022-08-19 07:10:48 +00:00
|
|
|
mod member_referrer;
|
2022-08-22 07:32:24 +00:00
|
|
|
mod member_settlement_setting;
|
2022-08-08 10:11:55 +00:00
|
|
|
mod site;
|
2022-08-04 14:08:06 +00:00
|
|
|
|
2022-08-18 07:04:33 +00:00
|
|
|
mod api;
|
|
|
|
|
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-14 03:13:35 +00:00
|
|
|
let bank_service = bank::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-14 03:13:35 +00:00
|
|
|
let member_service =
|
|
|
|
member::service::Service::new(connection_broker.clone(), queue_broker.clone());
|
|
|
|
let member_bank_account_service =
|
|
|
|
member_bank_account::service::Service::new(connection_broker.clone(), queue_broker.clone());
|
|
|
|
let member_bank_deposit_service =
|
|
|
|
member_bank_deposit::service::Service::new(connection_broker.clone(), queue_broker.clone());
|
|
|
|
let member_bank_withdraw_service =
|
|
|
|
member_bank_withdraw::service::Service::new(connection_broker.clone(), queue_broker.clone());
|
2022-08-12 09:05:00 +00:00
|
|
|
let member_class_service =
|
|
|
|
member_class::service::Service::new(connection_broker.clone(), queue_broker.clone());
|
2022-08-22 07:32:24 +00:00
|
|
|
let member_game_setting_service =
|
|
|
|
member_game_setting::service::Service::new(connection_broker.clone(), queue_broker.clone());
|
2022-08-12 09:05:00 +00:00
|
|
|
let member_level_service =
|
|
|
|
member_level::service::Service::new(connection_broker.clone(), queue_broker.clone());
|
2022-08-19 07:10:48 +00:00
|
|
|
let member_referrer_service =
|
|
|
|
member_referrer::service::Service::new(connection_broker.clone(), queue_broker.clone());
|
2022-08-22 07:32:24 +00:00
|
|
|
let member_settlement_setting_service = member_settlement_setting::service::Service::new(
|
|
|
|
connection_broker.clone(),
|
|
|
|
queue_broker.clone(),
|
|
|
|
);
|
2022-08-14 03:13:35 +00:00
|
|
|
let site_service = site::service::Service::new(connection_broker.clone(), queue_broker.clone());
|
2022-08-04 14:08:06 +00:00
|
|
|
|
2022-08-19 07:16:12 +00:00
|
|
|
let api_vendor_service =
|
|
|
|
api::vendor::service::Service::new(connection_broker.clone(), queue_broker.clone());
|
|
|
|
let api_game_service =
|
|
|
|
api::game::service::Service::new(connection_broker.clone(), queue_broker.clone());
|
2022-08-18 07:04:33 +00:00
|
|
|
|
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!(
|
2022-08-14 03:13:35 +00:00
|
|
|
bank_service.subscribe(),
|
2022-08-11 05:34:46 +00:00
|
|
|
identity_service.subscribe(),
|
2022-08-14 03:13:35 +00:00
|
|
|
member_service.subscribe(),
|
|
|
|
member_bank_account_service.subscribe(),
|
|
|
|
member_bank_deposit_service.subscribe(),
|
|
|
|
member_bank_withdraw_service.subscribe(),
|
2022-08-12 09:05:00 +00:00
|
|
|
member_class_service.subscribe(),
|
2022-08-22 07:32:24 +00:00
|
|
|
member_game_setting_service.subscribe(),
|
2022-08-12 09:05:00 +00:00
|
|
|
member_level_service.subscribe(),
|
2022-08-19 07:10:48 +00:00
|
|
|
member_referrer_service.subscribe(),
|
2022-08-22 07:32:24 +00:00
|
|
|
member_settlement_setting_service.subscribe(),
|
2022-08-14 03:13:35 +00:00
|
|
|
site_service.subscribe(),
|
2022-08-19 07:16:12 +00:00
|
|
|
api_vendor_service.subscribe(),
|
|
|
|
api_game_service.subscribe(),
|
2022-08-11 05:34:46 +00:00
|
|
|
)?;
|
2022-08-04 14:08:06 +00:00
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|