title: Nuxt.js env Property, understanding and how to use it?
body: <p>following <a href="https://nuxtjs.org/api/configuration-env" rel="nofollow noreferrer">https://nuxtjs.org/api/configuration-env</a></p>
  
  <p>I have been trying to set up my apiUrl in <code>nuxt.config.js</code> <strong>once</strong> for the whole project, like:</p>
  
  <pre><code>export default {
    env: {
      apiUrl: process.env.MY_REMOTE_CMS_API_URL || 'http://localhost:1337'
    }
  }
  </code></pre>
  
  <p>adding this in <strong>nuxt.config.js</strong>, I'd expect (and would like) to have <strong>apiUrl</strong> accessible <em>everywhere</em> in the project. 
  In particular, it is needed for the 3 following cases:</p>
  
  <ol>
  <li><p>with <strong>axios</strong>, to generate static pages from dynamic urls (in <code>nuxt.config.js</code>)</p>
  
  <pre><code>generate: {
     routes: function () {
        return axios.get(apiUrl + '/posts')
          .then((res) =&gt; {
            return res.data.filter(page =&gt; {
              return page.publish === true;
            }).map(page =&gt; {
              return {
                route: '/news/' + page.slug
              }
            })
          })
      }
    },
  </code></pre></li>
  <li><p>with <strong>apollo</strong>, to get data via graphql (in <code>nuxt.config.js</code>)</p>
  
  <pre><code>  apollo: {
      clientConfigs: {
        default: {
          httpEndpoint: apiUrl + '/graphql'
        }
      }
    },
  </code></pre></li>
  <li><p>in <strong>every</strong> layout, page and components, as the base url of media:</p>
  
  <pre><code>&lt;img :src="apiUrl + item.image.url" /&gt;
  </code></pre></li>
  </ol>
  
  <p>As you might see, only thing I need is to 'print' the actual base url of the cms.
  I have also tried to access it with <code>process.env.apiUrl</code>, with no success.</p>
  
  <p>The only way I was able to make it has been to create an extra <code>plugin/apiUrl.js</code> file, which injects the api url, and seems wrong to me as I am now setting the apiUrl twice in my project.</p>
  
  <p>I asked this question in the past, but in a way less clear way. I was suggested to use dotenv, but from the docs it looks like adding an additional layer of complication that might not be necessary for a simpler setup.
  Thanks.</p>