diff options
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 9200cc2..21b351f 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -9,6 +9,7 @@ use ngit_grasp::{ | |||
| 9 | http, | 9 | http, |
| 10 | metrics::Metrics, | 10 | metrics::Metrics, |
| 11 | nostr, | 11 | nostr, |
| 12 | sync::SyncManager, | ||
| 12 | }; | 13 | }; |
| 13 | 14 | ||
| 14 | #[tokio::main] | 15 | #[tokio::main] |
| @@ -50,6 +51,21 @@ async fn main() -> Result<()> { | |||
| 50 | config.domain | 51 | config.domain |
| 51 | ); | 52 | ); |
| 52 | 53 | ||
| 54 | // Start SyncManager if sync_relay_url is configured | ||
| 55 | if let Some(ref sync_url) = config.sync_relay_url { | ||
| 56 | info!("Starting proactive sync from: {}", sync_url); | ||
| 57 | let sync_manager = SyncManager::new( | ||
| 58 | sync_url.clone(), | ||
| 59 | relay_with_db.database.clone(), | ||
| 60 | relay_with_db.write_policy.clone(), | ||
| 61 | ); | ||
| 62 | tokio::spawn(async move { | ||
| 63 | sync_manager.run().await; | ||
| 64 | }); | ||
| 65 | } else { | ||
| 66 | info!("Proactive sync disabled (no NGIT_SYNC_RELAY_URL configured)"); | ||
| 67 | } | ||
| 68 | |||
| 53 | // Start HTTP server with integrated relay and database | 69 | // Start HTTP server with integrated relay and database |
| 54 | info!("Starting HTTP server on {}", config.bind_address); | 70 | info!("Starting HTTP server on {}", config.bind_address); |
| 55 | http::run_server(config, relay_with_db.relay, relay_with_db.database, metrics).await?; | 71 | http::run_server(config, relay_with_db.relay, relay_with_db.database, metrics).await?; |