#Access environment variables during astro build

3 messages · Page 1 of 1 (latest)

runic rover
#

Hi,

I am trying to talk to my cms (sanity) during astro build to get urls for the sitemap for a astro SSR site. To do so I need to access my environment variables that holds my cms-sanity info. But all my variables for astro is undefined when running astro build. I think I am missing something basic or just doing this wrong. Any pointers appreciated ☺️ Here is my astro config file, terminal during astro build and my package.json for reference

runic rover
#

My bad! Found the solution by reading the astro docs more thoroughly. dotenv to the rescue

pseudo sail