From 57bc8cd9c021feaf08e139e8fb62800bc476068e Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 3 Dec 2025 11:17:39 +0000 Subject: improved settings cli flags > env vars > defaults --- src/main.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 1f18ab2..f80e920 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,10 @@ use anyhow::Result; use tracing::{info, Level}; use tracing_subscriber::FmtSubscriber; -use ngit_grasp::{config::Config, http, nostr}; +use ngit_grasp::{ + config::{Config, DatabaseBackend}, + http, nostr, +}; #[tokio::main] async fn main() -> Result<()> { @@ -14,10 +17,17 @@ async fn main() -> Result<()> { info!("Starting ngit-grasp with nostr-relay-builder..."); - // Load configuration - let config = Config::from_env()?; + // Load configuration (priority: CLI flags > env vars > .env file > defaults) + let config = Config::load()?; + info!("Configuration loaded: {}", config.bind_address); - info!("Git data directory: {}", config.git_data_path); + info!("Domain: {}", config.domain); + info!("Relay name: {}", config.relay_name()); + info!("Git data directory: {}", config.effective_git_data_path()); + if config.database_backend != DatabaseBackend::Memory { + info!("Relay data directory: {}", config.relay_data_path); + } + info!("Database backend: {}", config.database_backend); // Create Nostr relay with NIP-34 validation // Returns both the relay and database for direct queries in handlers -- cgit v1.2.3