fix: environment variables - now using @nuxtjs/dotenv

This commit is contained in:
ManjaroOne666 2019-02-25 18:31:31 +00:00
parent dbd240c8ec
commit 305b4b8ca9
3 changed files with 34 additions and 19 deletions

View File

@ -3,16 +3,9 @@ const pkg = require('./package')
module.exports = { module.exports = {
mode: 'universal', mode: 'universal',
env: {
urlInternal: process.env.URL_INTERNAL,
urlExternal: process.env.URL_EXTERNAL,
portApp: process.env.PORT_APP,
portServer: process.env.PORT_SERVER,
},
server: { server: {
port: process.env.portApp, port: process.env.PORT_APP,
host: process.env.urlInternal, host: process.env.URL_INTERNAL,
}, },
serverMiddleware: [ serverMiddleware: [
@ -82,18 +75,20 @@ module.exports = {
** Nuxt.js modules ** Nuxt.js modules
*/ */
modules: [ modules: [
// Doc: https://github.com/nuxt-community/axios-module#usage
'@nuxtjs/axios', '@nuxtjs/axios',
// Doc: https://buefy.github.io/#/documentation
'nuxt-buefy', 'nuxt-buefy',
// [
// 'nuxt-sass-resources-loader',
// [
// '@/assets/scss/_globals.scss'
// ]
// ],
'@nuxtjs/style-resources', '@nuxtjs/style-resources',
'@nuxtjs/proxy', '@nuxtjs/proxy',
['@nuxtjs/dotenv', {
path: '../',
systemvars: true,
only: [
'URL_INTERNAL',
'URL_EXTERNAL',
'PORT_APP',
'PORT_SERVER',
],
}]
], ],
styleResources: { styleResources: {
@ -106,12 +101,12 @@ module.exports = {
axios: { axios: {
// See https://github.com/nuxt-community/axios-module#options // See https://github.com/nuxt-community/axios-module#options
proxy: true, proxy: true,
baseURL: 'http://' + process.env.urlExternal + ':' + process.env.portApp, baseURL: 'http://' + process.env.URL_EXTERNAL + ':' + process.env.PORT_APP,
debug: false, debug: false,
}, },
proxy: { proxy: {
'/api/v1/': 'http://' + process.env.urlExternal + ':' + process.env.portServer '/api/v1/': 'http://' + process.env.URL_EXTERNAL + ':' + process.env.PORT_SERVER
}, },
/* /*

5
package.json Normal file
View File

@ -0,0 +1,5 @@
{
"dependencies": {
"@nuxtjs/dotenv": "^1.3.0"
}
}

15
yarn.lock Normal file
View File

@ -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==