feat(docs): consume .env.example from plugwerk on every release (#101)#108
Merged
Conversation
Wire the configuration page to the canonical .env.example file shipped by plugwerk/plugwerk. The sync workflow and seed file already landed in main (commit 330fa5a); this commit adds the consumer-side glue so the synced file actually appears in the rendered docs. Helper: - src/lib/envExample.ts (new): build-time loader that reads public/config/env.example via node:fs (mirror of src/lib/deploy.ts pattern). Exports two surfaces: * `envExample` — the full file as a string * `envExampleSection(name)` — extracts a single `# --- name ---` block (the body lines up to the next `# ---` marker), trimmed. Throws on missing section so an upstream format change fails the build instead of silently rendering an empty <Code> block. server/configuration.mdx: - Imports `Code` from Starlight and the two helpers from envExample. - New paragraph in the page intro pointing at the full reference at the bottom of the page. - New H3 "OIDC defaults from `.env.example`" at the end of the encryption-key safety section, rendering just the OIDC-hardening excerpt via envExampleSection. Picks OIDC because the surrounding Configuration sections are the most heavily cross-linked from oidc-providers.mdx — operators reach this excerpt naturally from the troubleshooting and best-practices flows shipped in #93/#107. - New "Full `.env.example` reference" H2 section at the bottom of the page (just before nothing — it is the last section), rendering the whole file inside a single <Code lang="bash" title=".env.example"> block. Trailing line points at the static asset /config/env.example for direct curl/wget consumption. Curated tables left intact — they carry the security warnings, migration notes and worked examples that the raw .env.example file does not. The full reference dump now stands alongside as the canonical source of defaults. Verification: - npm run format / format:check / build all green (32 pages, no drift) - AGENTS.md ADR/internal-link grep clean in new content - dist/server/configuration/ contains both anchors and 6 occurrences of PLUGWERK_AUTH_OIDC_FAIL_FAST_ON_UNDECRYPTABLE_PROVIDERS (proves the OIDC excerpt + full dump both render the same source) - dist/config/env.example is served as a static asset Closes #101
15 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #101.
The sync workflow and the seed file already landed in main as part of commit
330fa5a("feat(docs): seed .env.example + add release-sync workflow"). This PR adds the consumer-side glue so the synced file actually appears in the rendered docs.What was already there before this PR
.github/workflows/sync-env-example.ymlpublic/config/env.exampleWhat this PR adds
src/lib/envExample.ts(new)src/lib/deploy.tspattern). ExportsenvExample(full string) andenvExampleSection(name)(extracts a# --- name ---block, trimmed; throws on missing section so upstream format drift fails the build instead of silently rendering empty).src/content/docs/server/configuration.mdxCodefrom Starlight. Adds: (1) an intro paragraph pointing at the full reference, (2) an inline OIDC excerpt at the end of the encryption-key safety section, and (3) a "Full.env.examplereference" H2 at the bottom of the page rendering the whole file.Why OIDC as the first inline excerpt
The OIDC sections in
configuration.mdxare the most heavily cross-linked surface — both#oidc-ssrf-guardand#oidc-encryption-key-safetyare reached from the troubleshooting and best-practices flows inoidc-providers.mdx(shipped via #93 and #107). The OIDC excerpt sits right where readers land via those cross-links and shows the canonical defaults next to the curated commentary.Other section excerpts (Database, S3 storage, scheduler, …) can land later as separate small PRs once the pattern is proven.
Cleanup posture
Conservative on purpose. The curated tables stay intact — they carry security warnings, migration notes, and worked examples that the raw
.env.examplefile does not. The full reference dump now sits alongside as the canonical source of defaults, and the page intro points readers at it. A follow-up issue can review the tables row-by-row forKEY=DEFAULT-only duplicates that no longer add value.Acceptance criteria from #101
env-example-updatedispatch — landed in330fa5a, paired with this PR.configuration.mdxrenders the full.env.examplecontent from the synced file (no copy-paste).workflow_dispatchaccept aversioninput identical tosync-openapi.yml— verified by reading the workflow file.configuration.mdxreferences the synced file inline (proves the integration works end-to-end) — OIDC excerpt at the end of the encryption-key safety section.Test plan
npm run formatcleannpm run format:checkcleannpm run buildclean (32 pages, no drift)#full-envexample-reference,#oidc-defaults-from-envexample) renderPLUGWERK_AUTH_OIDC_FAIL_FAST_ON_UNDECRYPTABLE_PROVIDERSappears 6 times indist/server/configuration/index.html— proves both excerpts render from the same synced source/config/env.exampleis served (operators cancurlit)/server/configuration/, verify the page intro mentions the full reference, the OIDC excerpt block at the end of the encryption-key safety section shows ~30 lines of# OIDC hardening …content, and the full reference dump at the bottom shows the complete annotated template.Out of scope
KEY=DEFAULT-only rows that are now duplicated by the full dump — a separate editorial pass, will benefit from seeing the rendered page in production first.# ---sections (Database, S3 storage, scheduler, etc.) — proven pattern can be replicated section by section as small follow-up PRs.