Start to build backend base
This commit is contained in:
@@ -1,3 +1,27 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
use actix_session::storage::RedisSessionStore;
|
||||
use actix_web::cookie::Key;
|
||||
use actix_web::{App, HttpServer};
|
||||
use matrixgw_backend::app_config::AppConfig;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||
|
||||
let secret_key = Key::from(AppConfig::get().secret().as_bytes());
|
||||
|
||||
let redis_store = RedisSessionStore::new(AppConfig::get().redis_connection_string())
|
||||
.await
|
||||
.expect("Failed to connect to Redis!");
|
||||
|
||||
log::info!(
|
||||
"Starting to listen on {} for {}",
|
||||
AppConfig::get().listen_address,
|
||||
AppConfig::get().website_origin
|
||||
);
|
||||
|
||||
HttpServer::new(move || App::new())
|
||||
.workers(4)
|
||||
.bind(&AppConfig::get().listen_address)?
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user