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: me+blog@natalie.lol.
Configuration
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
CF_PAGES_COMMIT_SHA- hash of current commitCF_PAGES_PAGES- equal to 1 in all pages build environmentsCF_PAGES_BRANCH- name of branch used to build deploymentCF_PAGES_URL- url of deployment at time of build- engine/language version variables
NODE_VERSIONGO_VERSIONPYTHON_VERSIONRUBY_VERSIONEMBEDDED_DART_SASS_VERSIONHUGO_VERSIONPNPM_VERSIONYARN_VERSIONBUN_VERSION
why tf isn’t this documented?!?!!?!?!?!?!?!?! ↩︎