Can we access domain name within the build phases?

I would like to know whether there is a way to access the domain URL where the site build is getting deployed in any of the build phases(apart from reading it from the netlify config file)?

Hey @bravokeyl there are a number of ENV variables in the build system

Here is a comprehensive list BIG FAT LIST OF NETLIFY ENV VARS - now documented at https://docs.netlify.com/configure-builds/environment-variables/#declare-variables · GitHub

Sounds like you are looking for DEPLOY_URL, DEPLOY_PRIME_URL, or URL

Yes! Exactly what I’m looking for.

1 Like