diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-03 11:17:39 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-03 11:19:20 +0000 |
| commit | 57bc8cd9c021feaf08e139e8fb62800bc476068e (patch) | |
| tree | c62abdffb4c91999cae2f570597b9ac154c2e51d /src/main.rs | |
| parent | 2f8ecd482077d82f2d1a937c7f979eaaa87a27b2 (diff) | |
improved settings cli flags > env vars > defaults
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 18 |
1 files changed, 14 insertions, 4 deletions
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; | |||
| 2 | use tracing::{info, Level}; | 2 | use tracing::{info, Level}; |
| 3 | use tracing_subscriber::FmtSubscriber; | 3 | use tracing_subscriber::FmtSubscriber; |
| 4 | 4 | ||
| 5 | use ngit_grasp::{config::Config, http, nostr}; | 5 | use ngit_grasp::{ |
| 6 | config::{Config, DatabaseBackend}, | ||
| 7 | http, nostr, | ||
| 8 | }; | ||
| 6 | 9 | ||
| 7 | #[tokio::main] | 10 | #[tokio::main] |
| 8 | async fn main() -> Result<()> { | 11 | async fn main() -> Result<()> { |
| @@ -14,10 +17,17 @@ async fn main() -> Result<()> { | |||
| 14 | 17 | ||
| 15 | info!("Starting ngit-grasp with nostr-relay-builder..."); | 18 | info!("Starting ngit-grasp with nostr-relay-builder..."); |
| 16 | 19 | ||
| 17 | // Load configuration | 20 | // Load configuration (priority: CLI flags > env vars > .env file > defaults) |
| 18 | let config = Config::from_env()?; | 21 | let config = Config::load()?; |
| 22 | |||
| 19 | info!("Configuration loaded: {}", config.bind_address); | 23 | info!("Configuration loaded: {}", config.bind_address); |
| 20 | info!("Git data directory: {}", config.git_data_path); | 24 | info!("Domain: {}", config.domain); |
| 25 | info!("Relay name: {}", config.relay_name()); | ||
| 26 | info!("Git data directory: {}", config.effective_git_data_path()); | ||
| 27 | if config.database_backend != DatabaseBackend::Memory { | ||
| 28 | info!("Relay data directory: {}", config.relay_data_path); | ||
| 29 | } | ||
| 30 | info!("Database backend: {}", config.database_backend); | ||
| 21 | 31 | ||
| 22 | // Create Nostr relay with NIP-34 validation | 32 | // Create Nostr relay with NIP-34 validation |
| 23 | // Returns both the relay and database for direct queries in handlers | 33 | // Returns both the relay and database for direct queries in handlers |