Cloudflare Pages environment variables

🪴 🌿 [?]

As far as I can tell, there is no complete list of environment variables that can be accessed in Cloudflare Pages runtimes, or used to manipulate them. Below is a list of the ones I have found. If you find or know of more, please email me: [email protected].

Configuration #

  1. TZ=America/New_York - setting this allows you to manipulate the build VM’s timezone. If you do not do this, you may have inconsistent timezone rendering between builds in frameworks like Liquid, as CF can build each deployment in a different data center.[1]

Injected #

  1. CF_PAGES_COMMIT_SHA - hash of current commit
  2. CF_PAGES_PAGES - equal to 1 in all pages build environments
  3. CF_PAGES_BRANCH - name of branch used to build deployment
  4. CF_PAGES_URL - url of deployment at time of build
  5. engine/language version variables
    1. NODE_VERSION
    2. GO_VERSION
    3. PYTHON_VERSION
    4. RUBY_VERSION
    5. EMBEDDED_DART_SASS_VERSION
    6. HUGO_VERSION
    7. PNPM_VERSION
    8. YARN_VERSION
    9. BUN_VERSION

  1. why tf isn’t this documented?!?!!?!?!?!?!?!?! ↩︎

next post
NJT Fare Holiday Adventure: Day trip to Philly
previous post
Week two in NYC: COVID-19