diff --git a/build/dev-server.js b/build/dev-server.js index 0ca0c731..907efb5d 100644 --- a/build/dev-server.js +++ b/build/dev-server.js @@ -1,12 +1,11 @@ require('./check-versions')() var config = require('../config') -if (!process.env.NODE_ENV) { - process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV) -} -if (!process.env.GOOGLE_CLIENT_ID) { - process.env.GOOGLE_CLIENT_ID = JSON.parse(config.dev.env.GOOGLE_CLIENT_ID) -} +Object.entries(config.dev.env).forEach(([key, value]) => { + if (!process.env[key]) { + process.env[key] = JSON.parse(value); + } +}); var opn = require('opn') var path = require('path') diff --git a/index.js b/index.js index 67479080..4ff493f3 100644 --- a/index.js +++ b/index.js @@ -1,11 +1,10 @@ const env = require('./config/prod.env'); -if (!process.env.NODE_ENV) { - process.env.NODE_ENV = JSON.parse(env.NODE_ENV); -} -if (!process.env.GOOGLE_CLIENT_ID) { - process.env.GOOGLE_CLIENT_ID = JSON.parse(env.GOOGLE_CLIENT_ID); -} +Object.entries(env).forEach(([key, value]) => { + if (!process.env[key]) { + process.env[key] = JSON.parse(value); + } +}); const http = require('http'); const https = require('https');