upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 7da4c735b06ee68d772e3941bef13adc3b8d0046 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use anyhow::Result;
use tracing::{info, Level};
use tracing_subscriber::FmtSubscriber;

mod config;
mod nostr;
mod storage;

use config::Config;

#[tokio::main]
async fn main() -> Result<()> {
    // Initialize tracing
    let subscriber = FmtSubscriber::builder()
        .with_max_level(Level::DEBUG)
        .finish();
    tracing::subscriber::set_global_default(subscriber)?;

    info!("Starting ngit-grasp...");

    // Load configuration
    let config = Config::from_env()?;
    info!("Configuration loaded: {}", config.bind_address);

    // Initialize storage
    let storage = storage::Storage::new(&config)?;
    info!("Storage initialized at: {}", config.relay_data_path);

    // Start Nostr relay
    let relay = nostr::relay::RelayServer::new(config.clone(), storage)?;
    
    info!("Starting Nostr relay on {}", config.bind_address);
    relay.run().await?;

    Ok(())
}