AES-256-GCM secret storage keyed by MASTER_KEY, SMTP settings with test mail (lettre), persisted job runs with log and status, JobRunner with per-kind concurrency guard, 6-field cron schedules with defaults, scheduler loop. Settings and Jobs pages in the UI. FAKE_HOST mode for dev machines. Tests: 30 application, 8 infrastructure, 23 API, 16 Vitest, 6 Playwright. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
37 lines
1.3 KiB
Rust
37 lines
1.3 KiB
Rust
use axum::Json;
|
|
use utoipa::openapi::security::{HttpAuthScheme, HttpBuilder, SecurityScheme};
|
|
use utoipa::{Modify, OpenApi};
|
|
|
|
struct BearerAuth;
|
|
impl Modify for BearerAuth {
|
|
fn modify(&self, openapi: &mut utoipa::openapi::OpenApi) {
|
|
let components = openapi.components.get_or_insert_with(Default::default);
|
|
components.add_security_scheme(
|
|
"bearer",
|
|
SecurityScheme::Http(
|
|
HttpBuilder::new()
|
|
.scheme(HttpAuthScheme::Bearer)
|
|
.bearer_format("JWT")
|
|
.build(),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
#[derive(OpenApi)]
|
|
#[openapi(
|
|
info(title = "SoftVisor Monitoring API", version = "0.1.0"),
|
|
paths(
|
|
crate::auth::login, crate::auth::refresh, crate::auth::logout, crate::auth::me,
|
|
crate::users::list, crate::users::create, crate::users::get_one, crate::users::update, crate::users::reset_password,
|
|
crate::settings::get_smtp, crate::settings::put_smtp, crate::settings::test_smtp, crate::settings::list_schedules, crate::settings::put_schedule,
|
|
crate::jobs::list, crate::jobs::kinds, crate::jobs::get_one, crate::jobs::run,
|
|
),
|
|
modifiers(&BearerAuth)
|
|
)]
|
|
pub struct ApiDoc;
|
|
|
|
pub async fn spec() -> Json<utoipa::openapi::OpenApi> {
|
|
Json(ApiDoc::openapi())
|
|
}
|