clarkdo / hare

🐇 Application boilerplate based on Vue.js 2.x, Koa 2.x, Element-UI and Nuxt.js

Home Page:https://nuxt-hare.herokuapp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

process.env available in generate: route function

dsmurl opened this issue · comments

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.

This feature request is available on Nuxt.js community (#c22)

@dsmurl I think you opened the issue to the wrong repo 😄