This commit is contained in:
@@ -5,9 +5,11 @@ use weight_tracker::{AppState, create_app, config::Config};
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
// Load configuration from config.toml or environment variables
|
||||
let config = Config::load("config.toml").unwrap_or_else(|_| {
|
||||
println!("config.toml not found, using environment variables");
|
||||
Config::from_env()
|
||||
// config-rs automatically merges file + environment + defaults
|
||||
let config = Config::load("config.toml").unwrap_or_else(|e| {
|
||||
eprintln!("Failed to load configuration: {}", e);
|
||||
eprintln!("Using default values. Set environment variables prefixed with WEIGHT_TRACKER_ to override.");
|
||||
std::process::exit(1);
|
||||
});
|
||||
|
||||
// Set up database
|
||||
|
||||
Reference in New Issue
Block a user