refactor: Add support for multiple static tokens to registration token service

This commit is contained in:
Ginger
2026-02-12 10:16:03 -05:00
committed by Ellis Git
parent 7d0686f33c
commit b2a87e2fb9
3 changed files with 28 additions and 31 deletions
+13
View File
@@ -7,12 +7,25 @@ use conduwuit::{
error, implement,
};
use crate::registration_tokens::{ValidToken, ValidTokenSource};
pub struct Service {
server: Arc<Server>,
}
const SIGNAL: &str = "SIGUSR1";
impl Service {
/// Get the registration token set in the config file, if it exists.
#[must_use]
pub fn get_config_file_token(&self) -> Option<ValidToken> {
self.registration_token.clone().map(|token| ValidToken {
token,
source: ValidTokenSource::ConfigFile,
})
}
}
#[async_trait]
impl crate::Service for Service {
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {