Files
cms-plugins/app/astro.config.mjs
T
Oleks 8c119efff8 harden(deploy): apply safe fixes from review report-only items
- #3 Liveness probe targets full SSR DB-querying / route, coupling pod liveness to SQLite
- #4 Chart values-staging/production.yaml are dead config under Flux; drift trap
- #6 tsconfig includes gitignored emdash-env.d.ts that only the dev server generates
- #7 Dockerfile package-lock glob + npm install fallback can silently build an unlocked image
- #8 Dockerfile creates runtime user without pinning its GID
- #9 entrypoint.sh gates `emdash init` on data.db absence, skipping migrations on PVC reuse
- #10 pullPolicy: Always vs digest pinning
- #11 Dockerfile state symlinks contradict the STATE_DIR contract; Dockerfile does not set ENV STATE_DIR
- #12 astro is a production dependency, so npm prune --omit=dev keeps build-only tooling
- #14 Two ImageUpdateAutomations write back to the same anton-helm-workloads main branch
- #16 memoryCache provider is per-process; correctness depends implicitly on replicas:1
- #17 Root catch-all [slug].astro couples nav links to pages-collection rows + DB hit per unmatched path
- #18 Detail pages render a 200-style body under a 404 status and have no try/catch around getEmDash* calls
- #19 vite allowedHosts hardcodes ddev hostnames (dev-only; no prod impact)
2026-06-02 04:50:54 +03:00

43 lines
1.3 KiB
JavaScript

import node from "@astrojs/node";
import { defineConfig, memoryCache } from "astro/config";
import emdash, { local } from "emdash/astro";
import { sqlite } from "emdash/db";
// Persistent state directory. Defaults to the working directory for dev/DDEV
// (so data.db + uploads/ stay where you'd expect them). The k8s deploy sets
// STATE_DIR=/app/state and mounts a PVC there so SQLite + uploads survive
// pod replacement.
const stateDir = process.env.STATE_DIR ?? ".";
export default defineConfig({
output: "server",
adapter: node({ mode: "standalone" }),
trailingSlash: "ignore",
server: { host: true, port: 4321 },
vite: {
server: {
// Dev-only: `vite.server` applies to `astro dev` / `emdash dev`
// (DDEV's nginx fronts https://cms-plugins.ddev.site/). Production
// runs the @astrojs/node standalone server, so this has no prod effect.
allowedHosts: ["cms-plugins.ddev.site", ".ddev.site"],
},
},
image: {
layout: "constrained",
responsiveStyles: true,
},
integrations: [
emdash({
database: sqlite({ url: `file:${stateDir}/data.db` }),
storage: local({
directory: `${stateDir}/uploads`,
baseUrl: "/_emdash/api/media/file",
}),
}),
],
experimental: {
cache: { provider: memoryCache() },
},
devToolbar: { enabled: false },
});