Init
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
use oxspeak_server_lib::config::AppConfig;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Enable tracing
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(
|
||||
std::env::var("RUST_LOG")
|
||||
.unwrap_or_else(|_| "info,sqlx=debug,sea_orm=debug,sea_orm_migration=info".into()),
|
||||
)
|
||||
.with_target(true)
|
||||
.with_level(true)
|
||||
.with_thread_ids(false)
|
||||
.with_thread_names(false)
|
||||
.init();
|
||||
|
||||
// Load or generate config
|
||||
if !AppConfig::file_exists() {
|
||||
AppConfig::gen_config()?;
|
||||
tracing::info!(config_path = "config.toml", "Generated");
|
||||
tracing::info!("Config generated, please edit config.toml");
|
||||
return Ok(())
|
||||
}
|
||||
let config = AppConfig::load()?;
|
||||
tracing::info!(?config, "Loaded config");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user