voorhoede / head-start

Base setup on top of headless services to help you quickly start a new website
ISC License
3 stars 0 forks source link

Match Cloudflare previews with DatoCMS environments #11

Closed jbmoelker closed 11 months ago

jbmoelker commented 1 year ago

User story

As a developer/reviewer, I want Cloudflare deploy previews to use a specific related DatoCMS environment when it's available, so that I can review CMS changes on the connected deploy previews.

Checklist

jbmoelker commented 1 year ago

Logic to get DatoCMS environment matching the current branch, defaulting to the primary environment: https://github.com/voorhoede/head-start/blob/d241311edf55e893800011ce611c598d19728f4c/scripts/lib/datocms.mjs

jbmoelker commented 11 months ago

Easier alternative? Some config/datocms-env.json file (or other format) that can be read synchronously by any tool (own build scripts, Astro, GraphQL gen, etc)

{
  "branch-name-a": "datocms-env-x",
  "branch-name-b": "datocms-env-y"
}

(and some rule to always default to the "main" environment if no matching branch environment is found)

Could extend or add a similar file for other environments (like Supabase or Cloudflare D1 or ...) in the future.

File will grow, but since it's basically just for build tools I don't think that that's a real concern.

jbmoelker commented 11 months ago

Resolved in a simpler way by #26 .