From 305b4b8ca9ef6c00ee7c7440aed86b10287b1d49 Mon Sep 17 00:00:00 2001 From: ManjaroOne666 Date: Mon, 25 Feb 2019 18:31:31 +0000 Subject: [PATCH] fix: environment variables - now using @nuxtjs/dotenv --- app/nuxt.config.js | 33 ++++++++++++++------------------- package.json | 5 +++++ yarn.lock | 15 +++++++++++++++ 3 files changed, 34 insertions(+), 19 deletions(-) create mode 100644 package.json create mode 100644 yarn.lock diff --git a/app/nuxt.config.js b/app/nuxt.config.js index 937a195..b6641a6 100644 --- a/app/nuxt.config.js +++ b/app/nuxt.config.js @@ -3,16 +3,9 @@ const pkg = require('./package') module.exports = { mode: 'universal', - env: { - urlInternal: process.env.URL_INTERNAL, - urlExternal: process.env.URL_EXTERNAL, - portApp: process.env.PORT_APP, - portServer: process.env.PORT_SERVER, - }, - server: { - port: process.env.portApp, - host: process.env.urlInternal, + port: process.env.PORT_APP, + host: process.env.URL_INTERNAL, }, serverMiddleware: [ @@ -82,18 +75,20 @@ module.exports = { ** Nuxt.js modules */ modules: [ - // Doc: https://github.com/nuxt-community/axios-module#usage '@nuxtjs/axios', - // Doc: https://buefy.github.io/#/documentation 'nuxt-buefy', - // [ - // 'nuxt-sass-resources-loader', - // [ - // '@/assets/scss/_globals.scss' - // ] - // ], '@nuxtjs/style-resources', '@nuxtjs/proxy', + ['@nuxtjs/dotenv', { + path: '../', + systemvars: true, + only: [ + 'URL_INTERNAL', + 'URL_EXTERNAL', + 'PORT_APP', + 'PORT_SERVER', + ], + }] ], styleResources: { @@ -106,12 +101,12 @@ module.exports = { axios: { // See https://github.com/nuxt-community/axios-module#options proxy: true, - baseURL: 'http://' + process.env.urlExternal + ':' + process.env.portApp, + baseURL: 'http://' + process.env.URL_EXTERNAL + ':' + process.env.PORT_APP, debug: false, }, proxy: { - '/api/v1/': 'http://' + process.env.urlExternal + ':' + process.env.portServer + '/api/v1/': 'http://' + process.env.URL_EXTERNAL + ':' + process.env.PORT_SERVER }, /* diff --git a/package.json b/package.json new file mode 100644 index 0000000..22d03fe --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@nuxtjs/dotenv": "^1.3.0" + } +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..8dbc03b --- /dev/null +++ b/yarn.lock @@ -0,0 +1,15 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@nuxtjs/dotenv@^1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@nuxtjs/dotenv/-/dotenv-1.3.0.tgz#fcfd8fa9da767ce1a79c11104ab998d610e23731" + integrity sha512-gRs/NZJip+bame83Z4cQxMrMlVl0UjtXgM9TDIC37kLjUGbsvj/XJjAUbYgvubE1qtsc/PaNTaYXj5H73rpO/A== + dependencies: + dotenv "^6.0.0" + +dotenv@^6.0.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064" + integrity sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==