process.env available in generate: route function
dsmurl opened this issue · comments
Samuel Bagot commented
What problem does this feature solve?
there is no access to the process.env inside the functions inside generate::route. This means that one must commit secrets to the github repo if they are needed to make a call during the generation of static pages. Not a real world example below but is relavant to my situation.
Like:
generate: {
routes: function() {
const secretURL = process.env.API_URL + '?API_KEY=' + process.env.API_KEY; // process =.env here won't work here like in the
return axios.get(secretURL)
.then(res => {
What does the proposed changes look like?
generate: {
routes: function(contect or env) {
or just have generate run route functions somewhere where process.env is visible to the functions.
Xin Du (Clark) commented
@dsmurl I think you opened the issue to the wrong repo 😄