mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-23 15:39:28 -05:00
d6046ba20b
fixes #2325
30 lines
653 B
CoffeeScript
30 lines
653 B
CoffeeScript
require("./environment")
|
|
|
|
konfig = require("konfig")
|
|
|
|
getConfig = ->
|
|
{ env } = process
|
|
|
|
## backup previous env
|
|
previousNodeEnv = env.NODE_ENV
|
|
previousNodeEnvExisted = env.hasOwnProperty("NODE_ENV")
|
|
|
|
## we want to set node env to cypress env
|
|
## and then restore it back to the previous
|
|
env.NODE_ENV = env.CYPRESS_KONFIG_ENV or env.CYPRESS_ENV
|
|
|
|
## get the config values
|
|
config = konfig().app
|
|
|
|
## restore NODE_ENV to previous state
|
|
if previousNodeEnvExisted
|
|
env.NODE_ENV = previousNodeEnv
|
|
else
|
|
delete env.NODE_ENV
|
|
|
|
## return the config getter function
|
|
return (getter) ->
|
|
config[getter]
|
|
|
|
module.exports = getConfig()
|