cat_gateway/service/common/objects/config/
frontend_config.rsuse poem_openapi::{types::Example, Object};
#[derive(Object, Default, serde::Deserialize)]
#[oai(example = true)]
pub(crate) struct FrontendConfig {
sentry: Option<Sentry>,
}
impl Example for FrontendConfig {
fn example() -> Self {
FrontendConfig {
sentry: Some(Sentry::example()),
}
}
}
#[derive(Object, Default, serde::Deserialize)]
#[oai(example = true)]
pub(crate) struct Sentry {
#[oai(validator(max_length = "100", pattern = "^https?://"))]
dsn: String,
#[oai(validator(max_length = "100", pattern = "^[0-9a-zA-Z].*$"))]
release: Option<String>,
#[oai(validator(max_length = "100", pattern = "^[0-9a-zA-Z].*$"))]
environment: Option<String>,
}
impl Example for Sentry {
fn example() -> Self {
Sentry {
dsn: "https://example.com".to_string(),
release: Some("1.0.0".to_string()),
environment: Some("dev".to_string()),
}
}
}