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/nostr/builder.rs | |
| parent | 2f8ecd482077d82f2d1a937c7f979eaaa87a27b2 (diff) | |
improved settings cli flags > env vars > defaults
Diffstat (limited to 'src/nostr/builder.rs')
| -rw-r--r-- | src/nostr/builder.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/nostr/builder.rs b/src/nostr/builder.rs index eabb38f..904cba4 100644 --- a/src/nostr/builder.rs +++ b/src/nostr/builder.rs | |||
| @@ -1203,22 +1203,31 @@ pub fn create_relay(config: &Config) -> Result<RelayWithDatabase> { | |||
| 1203 | tracing::info!("Using LMDB backend at: {}", db_path.display()); | 1203 | tracing::info!("Using LMDB backend at: {}", db_path.display()); |
| 1204 | // Ensure the database directory exists | 1204 | // Ensure the database directory exists |
| 1205 | std::fs::create_dir_all(db_path).map_err(|e| { | 1205 | std::fs::create_dir_all(db_path).map_err(|e| { |
| 1206 | anyhow::anyhow!("Failed to create LMDB directory {}: {}", db_path.display(), e) | 1206 | anyhow::anyhow!( |
| 1207 | "Failed to create LMDB directory {}: {}", | ||
| 1208 | db_path.display(), | ||
| 1209 | e | ||
| 1210 | ) | ||
| 1207 | })?; | 1211 | })?; |
| 1208 | Arc::new(NostrLMDB::open(db_path).map_err(|e| { | 1212 | Arc::new(NostrLMDB::open(db_path).map_err(|e| { |
| 1209 | anyhow::anyhow!("Failed to open LMDB database at {}: {}", db_path.display(), e) | 1213 | anyhow::anyhow!( |
| 1214 | "Failed to open LMDB database at {}: {}", | ||
| 1215 | db_path.display(), | ||
| 1216 | e | ||
| 1217 | ) | ||
| 1210 | })?) | 1218 | })?) |
| 1211 | } | 1219 | } |
| 1212 | }; | 1220 | }; |
| 1213 | 1221 | ||
| 1214 | // Build relay with GRASP-01 validation | 1222 | // Build relay with GRASP-01 validation |
| 1215 | // Clone Arc for the write policy so both relay and policy can access the database | 1223 | // Clone Arc for the write policy so both relay and policy can access the database |
| 1224 | let git_data_path = config.effective_git_data_path(); | ||
| 1216 | let builder = RelayBuilder::default() | 1225 | let builder = RelayBuilder::default() |
| 1217 | .database(database.clone()) | 1226 | .database(database.clone()) |
| 1218 | .write_policy(Nip34WritePolicy::new( | 1227 | .write_policy(Nip34WritePolicy::new( |
| 1219 | &config.domain, | 1228 | &config.domain, |
| 1220 | database.clone(), | 1229 | database.clone(), |
| 1221 | &config.git_data_path, | 1230 | &git_data_path, |
| 1222 | )); | 1231 | )); |
| 1223 | 1232 | ||
| 1224 | tracing::info!( | 1233 | tracing::info!( |