Add a versioned backend catalog and YAML deployment configuration

This commit is contained in:
2026-11-30 17:11:03 +08:00
parent c270adbab4
commit 7982fffcda
22 changed files with 924 additions and 223 deletions
+34
View File
@@ -0,0 +1,34 @@
use serde::{Deserialize, Serialize};
use url::Url;
use crate::{ConfigError, ObjectStoreDriver};
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct ObjectStorage {
pub driver: ObjectStoreDriver,
pub bucket: String,
pub region: String,
pub endpoint: Option<String>,
}
impl ObjectStorage {
pub(crate) fn validate(&self) -> Result<(), ConfigError> {
if self.bucket.trim().is_empty() || self.region.trim().is_empty() {
return Err(ConfigError::ObjectStorage);
}
if let Some(endpoint) = &self.endpoint {
let url = Url::parse(endpoint).map_err(|_| ConfigError::ObjectStorage)?;
if !matches!(url.scheme(), "http" | "https")
|| url.host_str().is_none()
|| !url.username().is_empty()
|| url.password().is_some()
|| url.query().is_some()
|| url.fragment().is_some()
{
return Err(ConfigError::ObjectStorage);
}
}
Ok(())
}
}