Skip to content

Add deployment info debug section to admin panel#414

Merged
Carreau merged 1 commit into
mainfrom
claude/vibrant-lovelace-ayUqh
May 27, 2026
Merged

Add deployment info debug section to admin panel#414
Carreau merged 1 commit into
mainfrom
claude/vibrant-lovelace-ayUqh

Conversation

@Carreau

@Carreau Carreau commented May 27, 2026

Copy link
Copy Markdown
Member

Adds a new "Deployment" debug section to the admin panel that displays build-time and runtime configuration information, helping with debugging deployment issues.

Changes

  • Admin panel UI: Added a new "Deployment" section displaying:

    • PAPYRI_SITE — the canonical site origin (from Astro.site)
    • Request origin — the current request's origin
    • Adapter — which adapter was used at build time ("node" or "cloudflare")
    • Build commit — the git commit SHA baked in at build time
  • Build-time constants: Modified astro.config.mjs to:

    • Capture the git commit hash via git rev-parse HEAD at build time
    • Fall back to PAPYRI_COMMIT environment variable (for CI environments without .git)
    • Fall back to "unknown" if neither is available
    • Inject both PAPYRI_BUILD_COMMIT and PAPYRI_BUILD_ADAPTER into import.meta.env via Vite's define option (works in both Node and Cloudflare Workers adapters)
  • TypeScript types: Added ImportMetaEnv interface in env.d.ts to type the new build-time constants

  • Styling: Added CSS for the deployment table and related elements (muted labels, monospace commit hash with word-breaking, italicized "(not set)" indicator)

Implementation details

The build-time constants are injected via Vite's define option rather than process.env because Cloudflare Workers bundles don't have access to process.env at runtime. Static string replacement ensures the values are available in both deployment targets.

https://claude.ai/code/session_015U721nwm7oCgETQ2MFb8Fw

Exposes four values that are easy to misconfigure or lose track of after
a deploy:
- PAPYRI_SITE (the configured canonical origin via Astro.site)
- Request origin (what the server actually sees from the incoming request)
- Adapter (node vs cloudflare, baked at build time)
- Build commit (full SHA, baked at build time via vite.define)

The commit hash is captured in astro.config.mjs via `git rev-parse HEAD`
at bundle time, falling back to a PAPYRI_COMMIT env var (for Docker/CI
builds without a .git directory) and then to "unknown".

Both constants are injected as import.meta.env.PAPYRI_BUILD_COMMIT and
PAPYRI_BUILD_ADAPTER via vite.define so they survive tree-shaking in the
Cloudflare Workers bundle where process.env is not available at runtime.
@Carreau Carreau merged commit 60b4bf5 into main May 27, 2026
16 checks passed
@Carreau Carreau deleted the claude/vibrant-lovelace-ayUqh branch May 27, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants