use std::path::PathBuf;
mod handlers;
mod http;
#[cfg(test)]
mod tests;
mod validation;
pub use handlers::serve;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ServiceTlsMode {
Disabled,
OperatorOptional,
}
impl ServiceTlsMode {
pub fn parse(value: &str) -> Option<Self> {
match value {
"disabled" => Some(Self::Disabled),
"operator-optional" => Some(Self::OperatorOptional),
_ => None,
}
}
pub fn as_str(&self) -> &'static str {
match self {
Self::Disabled => "disabled",
Self::OperatorOptional => "operator-optional",
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ServiceConfig {
pub listen_address: String,
pub data_dir: PathBuf,
pub telemetry_endpoint: String,
pub tls_mode: ServiceTlsMode,
pub admin_token: Option<String>,
pub max_requests: usize,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ServiceValidationReport {
pub profile_id: &'static str,
pub compatible: bool,
pub missing_env: Vec<&'static str>,
pub missing_verbs: Vec<&'static str>,
pub missing_evidence_artifacts: Vec<&'static str>,
pub warnings: Vec<String>,
}
#[derive(Debug)]
pub enum ServiceError {
InvalidConfig(String),
Io(std::io::Error),
Driver(crate::features::client::DriverError),
}
impl From<std::io::Error> for ServiceError {
fn from(err: std::io::Error) -> Self {
Self::Io(err)
}
}
impl From<crate::features::client::DriverError> for ServiceError {
fn from(err: crate::features::client::DriverError) -> Self {
Self::Driver(err)
}
}