Allow HTTP to be used for configuring the server

This commit is contained in:
Maurus Decimus
2026-04-27 07:48:36 +02:00
parent cd4b08544c
commit 242bea67d9
8 changed files with 45 additions and 25 deletions

View File

@@ -38,6 +38,7 @@ use store::{
write::{AnyKey, BatchBuilder},
};
use types::id::Id;
use utils::is_valid_domain;
pub(crate) async fn bootstrap_get(
mut get: RegistryGetResponse<'_>,
@@ -505,15 +506,6 @@ pub(crate) async fn bootstrap_set(
Ok(set)
}
fn is_valid_domain(hostname: &str) -> bool {
const RESERVED_TLDS: &[&str] = &["test", "localhost", "local", "internal"];
psl::domain_str(hostname).is_some()
|| RESERVED_TLDS.contains(&hostname)
|| hostname
.rsplit_once('.')
.is_some_and(|(_, tld)| RESERVED_TLDS.contains(&tld))
}
async fn write_object(registry: &RegistryStore, object: &Object) -> Result<Id, SetError<Property>> {
match registry.write(RegistryWrite::insert(object)).await {
Ok(RegistryWriteResult::Success(id)) => Ok(id),