Access "Build settings" data in build step

As part of my build step, I need to know what base and publish directories I’ve configured in the Netlify “Build settings” page. I checked Build environment variables | Netlify Docs, but they don’t appear to be available. How can access these settings?


Hi, @mrk !

Sorry for the delay here, and welcome to Netlify Forums! This is a great question.

Have you made any progress on this since you posted four days ago? This support guide may outline a different way for you to access your build settings page. If this doesn’t help, reply to this thread and I can loop in another member of our team to get you some assistance.

Hi @hillary, I could t find anything in that thread or the docs to resolve the above.

hey @mrk,

i’m having a little trouble understanding exactlty what you need. Are you trying to access your build settings to do something programmatically with them as part of your build step in some way? If yes, could you give us a little more information about what you are trying to achieve?

i think that it may not be possible to access build settings programmatically until the build has completed, but if we know more about your end goal maybe we can suggest a different approach!

Hi @perry,

Thanks for the quick response! No worries if this isn’t available, I can always hardcode the path or write a script to derive it.

Context: I’m trying to grab my project’s base directory path (the one specified in the Build settings page) and provide it to my app’s build step as an env variable or flag. Use case is for dev tooling/debugging purposes - the base directory is necessary to point to the origin source. I’m 99% of the way there with the Git metadata flags, I just need to know the directory in question.

cool, thanks for clarifying! I am going to let someone weigh in who knows more about our build process than i do. My hunch is that this won’t work, but we’ll let them confirm.

Hi, @mrk. I can confirm that the build directory and publish directory are not available as environment variables in the build environment.

We can enter a feature request asking for them to be made available as environment variables. However, it isn’t possible to access these settings as environment variables currently.

Note, technically speaking, the environment variable PWD should always be the build directory but that will be a FQPN (fully-qualified path name) and not the relative path (meaning not the path relative to the build system’s working directory but the full path from the root directory /).

If there are other questions or if we should enter a feature request, please let us know.