feat(infra): enable production TLS for Phases 11-12 via coa-manager.duckdns.org

This commit is contained in:
Дмитрий committed 2026-10-09 07:12:42 +05:00
1 parent 42c05c50e7
commit 1dc212968d
16 files changed
+251 -65

No files matched your search

+1 -1
View File
@@ -100,7 +100,7 @@ type Wanted = BTreeMap<String, (RealmId, String, ed25519_dalek::SigningKey)>;
fn wanted(dir: &std::path::Path, keys: &dyn KeyStore, url_override: Option<&str>) -> Wanted {
let mut out = Wanted::new();
let Ok(s) = settings::load(dir) else { return out };
let Some(base) = url_override.map(str::to_string).or(s.url) else { return out };
let base = url_override.map(str::to_string).unwrap_or_else(|| s.effective_url().to_string());
let Some(url) = coordinator_url(&base, "/coord/v1/host") else { return out };
for (local_id, cfg) in s.realms {
let (true, Some(realm)) = (cfg.enabled, cfg.realm_id) else { continue };
+5 -4
View File
@@ -179,7 +179,7 @@ pub struct RegistryHost {
impl RegistryHost {
pub fn open(dir: &Path, keys: Arc<dyn KeyStore>, source: Arc<dyn AdvertSource>, clock: Clock, timing: Timing, now: Instant) -> Result<Self> {
let settings = settings::load(dir)?;
let client = settings.url.as_deref().map(RegistryClient::new).transpose()?;
let client = Some(RegistryClient::new(settings.effective_url())?);
let mut host = Self { dir: dir.to_path_buf(), settings, keys, source, clock, timing, client, publishers: BTreeMap::new() };
for (local, cfg) in host.settings.realms.clone() {
let mut p = Publisher::new(cfg.clone(), now);
@@ -192,7 +192,7 @@ impl RegistryHost {
}
pub fn url(&self) -> Option<&str> {
self.settings.url.as_deref()
Some(self.settings.effective_url())
}
/// The identity of an enabled realm: its id and key must both exist; a missing key is not replaced behind the owner's back.
@@ -231,7 +231,8 @@ impl RegistryHost {
if url == self.settings.url {
return Ok(());
}
self.client = url.as_deref().map(RegistryClient::new).transpose()?;
let effective = url.as_deref().unwrap_or(settings::DEFAULT_REGISTRY_URL);
self.client = Some(RegistryClient::new(effective)?);
self.settings.url = url;
self.save()?;
for p in self.publishers.values_mut().filter(|p| p.cfg.enabled && p.key.is_some()) {
@@ -356,7 +357,7 @@ impl RegistryHost {
retry_in_secs: p.due.map(|d| d.saturating_duration_since(now).as_secs()),
})
.collect();
RegistryStatus { url: self.settings.url.clone(), realms }
RegistryStatus { url: Some(self.settings.effective_url().to_string()), realms }
}
/// The public key a published realm is known by (never the private one).
@@ -59,6 +59,8 @@ impl PublishConfig {
}
}
pub const DEFAULT_REGISTRY_URL: &str = "https://coa-manager.duckdns.org";
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct RegistrySettings {
@@ -69,6 +71,13 @@ pub struct RegistrySettings {
pub realms: BTreeMap<String, PublishConfig>,
}
impl RegistrySettings {
/// The configured Registry address, or the production default (`https://coa-manager.duckdns.org`).
pub fn effective_url(&self) -> &str {
self.url.as_deref().unwrap_or(DEFAULT_REGISTRY_URL)
}
}
impl Default for RegistrySettings {
fn default() -> Self {
Self { schema: SETTINGS_SCHEMA, url: None, realms: BTreeMap::new() }