diff options
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..7da4c73 --- /dev/null +++ b/src/main.rs | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | use anyhow::Result; | ||
| 2 | use tracing::{info, Level}; | ||
| 3 | use tracing_subscriber::FmtSubscriber; | ||
| 4 | |||
| 5 | mod config; | ||
| 6 | mod nostr; | ||
| 7 | mod storage; | ||
| 8 | |||
| 9 | use config::Config; | ||
| 10 | |||
| 11 | #[tokio::main] | ||
| 12 | async fn main() -> Result<()> { | ||
| 13 | // Initialize tracing | ||
| 14 | let subscriber = FmtSubscriber::builder() | ||
| 15 | .with_max_level(Level::DEBUG) | ||
| 16 | .finish(); | ||
| 17 | tracing::subscriber::set_global_default(subscriber)?; | ||
| 18 | |||
| 19 | info!("Starting ngit-grasp..."); | ||
| 20 | |||
| 21 | // Load configuration | ||
| 22 | let config = Config::from_env()?; | ||
| 23 | info!("Configuration loaded: {}", config.bind_address); | ||
| 24 | |||
| 25 | // Initialize storage | ||
| 26 | let storage = storage::Storage::new(&config)?; | ||
| 27 | info!("Storage initialized at: {}", config.relay_data_path); | ||
| 28 | |||
| 29 | // Start Nostr relay | ||
| 30 | let relay = nostr::relay::RelayServer::new(config.clone(), storage)?; | ||
| 31 | |||
| 32 | info!("Starting Nostr relay on {}", config.bind_address); | ||
| 33 | relay.run().await?; | ||
| 34 | |||
| 35 | Ok(()) | ||
| 36 | } | ||