set env key
This commit is contained in:
@@ -7,13 +7,14 @@ const webpack = require('webpack')
|
|||||||
var path = require('path')
|
var path = require('path')
|
||||||
|
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
// call dotenv and it will return an Object with a parsed key
|
console.log('process', process.env.NODE_ENV)
|
||||||
let envKeys = {}
|
let envKeys = {}
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
envKeys = { API_KEY: process.env.API_KEY }
|
envKeys = { API_KEY: process.env.API_KEY }
|
||||||
} else {
|
} else {
|
||||||
// reduce env variables to an oject
|
// call dotenv and it will return an Object with a parsed key
|
||||||
const env = dotenv.config().parsed
|
const env = dotenv.config().parsed
|
||||||
|
// reduce env variables to an oject
|
||||||
envKeys = Object.keys(env).reduce((prev, next) => {
|
envKeys = Object.keys(env).reduce((prev, next) => {
|
||||||
prev[`process.env.${next}`] = JSON.stringify(env[next])
|
prev[`process.env.${next}`] = JSON.stringify(env[next])
|
||||||
return prev
|
return prev
|
||||||
|
|||||||
Reference in New Issue
Block a user