mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-14 06:59:07 -05:00
improvement: do not create NIP-05 thread if feature is disabled
This commit is contained in:
parent
9ce5057af8
commit
74802522c2
|
@ -64,7 +64,7 @@ pub struct Authorization {
|
||||||
pub pubkey_whitelist: Option<Vec<String>>, // If present, only allow these pubkeys to publish events
|
pub pubkey_whitelist: Option<Vec<String>>, // If present, only allow these pubkeys to publish events
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Copy)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
pub enum VerifiedUsersMode {
|
pub enum VerifiedUsersMode {
|
||||||
Enabled,
|
Enabled,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//! Server process
|
//! Server process
|
||||||
use crate::close::Close;
|
use crate::close::Close;
|
||||||
use crate::close::CloseCmd;
|
use crate::close::CloseCmd;
|
||||||
use crate::config::Settings;
|
use crate::config::{Settings, VerifiedUsersMode};
|
||||||
use crate::conn;
|
use crate::conn;
|
||||||
use crate::db;
|
use crate::db;
|
||||||
use crate::db::SubmittedEvent;
|
use crate::db::SubmittedEvent;
|
||||||
|
@ -253,8 +253,10 @@ pub fn start_server(settings: Settings, shutdown_rx: MpscReceiver<()>) -> Result
|
||||||
.await;
|
.await;
|
||||||
info!("db writer created");
|
info!("db writer created");
|
||||||
|
|
||||||
// create a nip-05 verifier thread
|
// create a nip-05 verifier thread; if enabled.
|
||||||
let verifier_opt = nip05::Verifier::new(metadata_rx, bcast_tx.clone(), settings.clone());
|
if settings.verified_users.mode != VerifiedUsersMode::Disabled {
|
||||||
|
let verifier_opt =
|
||||||
|
nip05::Verifier::new(metadata_rx, bcast_tx.clone(), settings.clone());
|
||||||
if let Ok(mut v) = verifier_opt {
|
if let Ok(mut v) = verifier_opt {
|
||||||
if verified_users_active {
|
if verified_users_active {
|
||||||
tokio::task::spawn(async move {
|
tokio::task::spawn(async move {
|
||||||
|
@ -263,6 +265,7 @@ pub fn start_server(settings: Settings, shutdown_rx: MpscReceiver<()>) -> Result
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// listen for (external to tokio) shutdown request
|
// listen for (external to tokio) shutdown request
|
||||||
let controlled_shutdown = invoke_shutdown.clone();
|
let controlled_shutdown = invoke_shutdown.clone();
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user