This commit is contained in:
parent
4765b236f5
commit
0215aa6aef
@ -3,7 +3,6 @@ use std::env;
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Config {
|
||||
pub database_url: String,
|
||||
pub jwt_secret: String,
|
||||
pub port: u16,
|
||||
pub local_oss: String,
|
||||
}
|
||||
@ -14,7 +13,6 @@ impl Config {
|
||||
|
||||
Ok(Config {
|
||||
database_url: env::var("DATABASE_URL")?,
|
||||
jwt_secret: env::var("JWT_SECRET")?,
|
||||
port: env::var("PORT")
|
||||
.unwrap_or_else(|_| "3000".to_string())
|
||||
.parse()
|
||||
|
||||
@ -8,6 +8,7 @@ mod utils;
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let config = config::Config::from_env().unwrap();
|
||||
println!("Loaded config: {:?}", config);
|
||||
let app = app::create_router(&config).await;
|
||||
let listener = tokio::net::TcpListener::bind(&format!("0.0.0.0:{}", config.port)).await?;
|
||||
axum::serve(listener, app).await?;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user