Add docs link in sidebar, Dockerfile for VitePress, make Keycloak optional
All checks were successful
CI / Tests (push) Has been skipped
CI / Format (push) Successful in 3s
CI / Clippy (push) Successful in 3m7s
CI / Security Audit (push) Has been skipped
CI / Format (pull_request) Successful in 3s
CI / Clippy (pull_request) Successful in 3m5s
CI / Security Audit (pull_request) Has been skipped
CI / Tests (pull_request) Has been skipped
All checks were successful
CI / Tests (push) Has been skipped
CI / Format (push) Successful in 3s
CI / Clippy (push) Successful in 3m7s
CI / Security Audit (push) Has been skipped
CI / Format (pull_request) Successful in 3s
CI / Clippy (pull_request) Successful in 3m5s
CI / Security Audit (pull_request) Has been skipped
CI / Tests (pull_request) Has been skipped
- Add external "Docs" link in sidebar with configurable DOCS_URL - Add Dockerfile.docs for VitePress static site (nginx) - Add DOCS_URL build arg to Dockerfile.dashboard - Run cargo fmt Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,8 +2,11 @@ FROM rust:1.89-bookworm AS builder
|
||||
|
||||
RUN cargo install dioxus-cli --version 0.7.3
|
||||
|
||||
ARG DOCS_URL=/docs
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
ENV DOCS_URL=${DOCS_URL}
|
||||
RUN dx build --release --package compliance-dashboard
|
||||
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
12
Dockerfile.docs
Normal file
12
Dockerfile.docs
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM node:22-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
COPY docs/package.json docs/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY docs/ .
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:alpine
|
||||
COPY --from=builder /app/.vitepress/dist /usr/share/nginx/html
|
||||
EXPOSE 80
|
||||
@@ -64,6 +64,8 @@ pub fn Sidebar() -> Element {
|
||||
},
|
||||
];
|
||||
|
||||
let docs_url = option_env!("DOCS_URL").unwrap_or("/docs");
|
||||
|
||||
let sidebar_class = if collapsed() {
|
||||
"sidebar collapsed"
|
||||
} else {
|
||||
@@ -106,6 +108,15 @@ pub fn Sidebar() -> Element {
|
||||
}
|
||||
}
|
||||
}
|
||||
a {
|
||||
href: "{docs_url}",
|
||||
target: "_blank",
|
||||
class: "nav-item",
|
||||
Icon { icon: BsBook, width: 18, height: 18 }
|
||||
if !collapsed() {
|
||||
span { "Docs" }
|
||||
}
|
||||
}
|
||||
button {
|
||||
class: "sidebar-toggle",
|
||||
onclick: move |_| collapsed.set(!collapsed()),
|
||||
|
||||
@@ -75,9 +75,9 @@ pub async fn auth_login(
|
||||
Extension(pending): Extension<PendingOAuthStore>,
|
||||
Query(params): Query<HashMap<String, String>>,
|
||||
) -> Result<impl IntoResponse, DashboardError> {
|
||||
let kc = state.keycloak.ok_or(DashboardError::Other(
|
||||
"Keycloak not configured".into(),
|
||||
))?;
|
||||
let kc = state
|
||||
.keycloak
|
||||
.ok_or(DashboardError::Other("Keycloak not configured".into()))?;
|
||||
let csrf_state = generate_state();
|
||||
let code_verifier = generate_code_verifier();
|
||||
let code_challenge = derive_code_challenge(&code_verifier);
|
||||
@@ -128,9 +128,9 @@ pub async fn auth_callback(
|
||||
Extension(pending): Extension<PendingOAuthStore>,
|
||||
Query(params): Query<HashMap<String, String>>,
|
||||
) -> Result<impl IntoResponse, DashboardError> {
|
||||
let kc = state.keycloak.ok_or(DashboardError::Other(
|
||||
"Keycloak not configured".into(),
|
||||
))?;
|
||||
let kc = state
|
||||
.keycloak
|
||||
.ok_or(DashboardError::Other("Keycloak not configured".into()))?;
|
||||
|
||||
let returned_state = params
|
||||
.get("state")
|
||||
@@ -214,9 +214,9 @@ pub async fn logout(
|
||||
session: Session,
|
||||
Extension(state): Extension<ServerState>,
|
||||
) -> Result<impl IntoResponse, DashboardError> {
|
||||
let kc = state.keycloak.ok_or(DashboardError::Other(
|
||||
"Keycloak not configured".into(),
|
||||
))?;
|
||||
let kc = state
|
||||
.keycloak
|
||||
.ok_or(DashboardError::Other("Keycloak not configured".into()))?;
|
||||
|
||||
session
|
||||
.flush()
|
||||
|
||||
@@ -52,4 +52,3 @@ impl KeycloakConfig {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user