Add configuration loading and error handling
Introduces a new `config` module for loading application settings from environment variables and a `users.toml` file. An `error` module is added to handle application-specific errors gracefully. An `.env.example` file is created to show available configuration options, and `users.toml.example` provides a template for user data. The main function now initializes the configuration and prints the server port.
This commit is contained in:
+11
-2
@@ -1,3 +1,12 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
mod config;
|
||||
mod error;
|
||||
|
||||
use config::Config;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
dotenvy::dotenv().ok();
|
||||
let config = Arc::new(Config::from_env());
|
||||
println!("Server starting on port {}", config.server_port);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user