upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 4e02eeacf5c449fb4f8ef6ccea790480e15cca20 (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
use anyhow::Result;
use tracing::{info, Level};
use tracing_subscriber::FmtSubscriber;

use ngit_grasp::{config::Config, http, nostr};

#[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 with nostr-relay-builder...");

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

    // Create Nostr relay with NIP-34 validation
    if let Ok(relay) = nostr::builder::create_relay(&config) {
        info!(
            "Relay created with NIP-34 validation for domain: {}",
            config.domain
        );

        // Start HTTP server with integrated relay
        info!("Starting HTTP server on {}", config.bind_address);
        http::run_server(config, relay).await?;
    }

    Ok(())
}