|
@ -0,0 +1,25 @@ |
|
|
|
|
|
use log::{info};
|
|
|
|
|
|
use elseware::entity::gateway::postgres::PostgresGateway;
|
|
|
|
|
|
use elseware::login::login::LoginServerState;
|
|
|
|
|
|
use elseware::login::character::CharacterServerState;
|
|
|
|
|
|
use elseware::common::mainloop::{login_mainloop, character_mainloop};
|
|
|
|
|
|
|
|
|
|
|
|
async fn main() {
|
|
|
|
|
|
let db_host = std::env::var("DB_HOST").unwrap();
|
|
|
|
|
|
let db_username = std::env::var("DB_USERNAME").unwrap();
|
|
|
|
|
|
let db_password = std::env::var("DB_PASSWORD").unwrap();
|
|
|
|
|
|
let db_dbname = std::env::var("DB_DBNAME").unwrap();
|
|
|
|
|
|
let entity_gateway = PostgresGateway::new(&db_host, &db_dbname, &db_username, &db_password);
|
|
|
|
|
|
|
|
|
|
|
|
let thread_entity_gateway = entity_gateway.clone();
|
|
|
|
|
|
let login_state = LoginServerState::new(thread_entity_gateway);
|
|
|
|
|
|
let login_loop = login_mainloop(login_state, elseware::login::login::LOGIN_PORT);
|
|
|
|
|
|
|
|
|
|
|
|
let char_state = CharacterServerState::new(entity_gateway);
|
|
|
|
|
|
let character_loop = character_mainloop(char_state, elseware::login::character::CHARACTER_PORT, elseware::login::login::COMMUNICATION_PORT);
|
|
|
|
|
|
|
|
|
|
|
|
info!("[auth/character] starting server");
|
|
|
|
|
|
async_std::task::block_on(async move {
|
|
|
|
|
|
futures::future::join_all(vec![login_loop, character_loop]).await
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|