- env-universal
- readEnv
- envDef
- env-universal/constants
- production
- test
- ci
- development
- qa
- staging
- preprod
- env-universal/utils
- getAppVersion
- getEnv
- getStage
- isDev
- isDeployed
- isCI
- isTest
- isQA
- isStaging
- isPreProd
- isProduction
- isHerokuReviewApp
- isServer
- isClient
- getPublicEnv
- getHerokuMetadata
- env-universal/serverUtils
- serverHost
- serverPort
Environment definitions and helpers
Note: in browser runtimes process.env will need to be defined
via something like Webpack's DefinePlugin
Given an environment config (defaults to process.env),
parse it into a standard environment definition
Parameters
configObject (optional, defaultprocess.env)
Returns Object envDef
A standardized environment description
- see
env-universal/constants - see
env-universal/utils
Properties
modeStringprocess.env.NODE_ENVstageStringprocess.env.APP_ENVversionString NPM package versionisObject config flags based on envserverObject server env configconstantsObjectconstantsmoduleutilsObjectutilsmodule
Production NODE_ENV and/or APP_ENV
Type: string
Test NODE_ENV
Type: string
CI NODE_ENV
Type: string
Development NODE_ENV
Type: string
QA APP_ENV
Type: string
Staging APP_ENV
Type: string
Preprod APP_ENV
Type: string
Get the app version from package.json
Parameters
Returns String
Get the application environment, defaults to development
Parameters
Returns String
Get the application deployment stage
Parameters
Returns String?
Is the application in development mode?
Parameters
Returns Boolean
Is the application deployed (NODE_ENV=production)
Parameters
Returns Boolean
Is the application in CI mode?
Parameters
Returns Boolean
Is the application in test mode?
Parameters
Returns Boolean
Is the application a qa deployment?
Parameters
Returns Boolean
Is the application a staging deployment?
Parameters
Returns Boolean
Is the application a preprod deployment?
Parameters
Returns Boolean
Is the application a production deployment?
Parameters
Returns Boolean
Is the application a heroku review app deployment?
Parameters
configObject (optional, default{})config.IS_REVIEW_APPany
Returns Boolean
Is the application running in a server runtime?
Parameters
configObject (optional, default{})config.SERVERany
Returns Boolean
Is the application running in a client runtime?
Parameters
configObject (optional, default{})config.CLIENTany
Returns Boolean
When building universal apps, it is common for a Node process to have sensitive information stored as environment variables. This isn't acceptable for client bundles, since they would be output in plaintext.
This utility serves to whitelist public keys.
It's output is meant for use with dotenv and
something like webpack.DefinePlugin
Parameters
publicKeysArray<String> keys from Nodeprocess.envto inject into a client bundleconfigObject (optional, defaultprocess.env)
Examples
see `test/browser/webpack.config`, and the `npm run test:browser` targetReturns Object stringified object extracted from process.env
This is only useful for applications running on heroku
with the runtime-dyno-metadata labs feature enabled and
is not included in the default output of env
Parameters
configObject (optional, default{})config.HEROKU_APP_NAMEString The application name. "example-app"config.HEROKU_RELEASE_CREATED_ATString The time and date the release was created. "2015-04-02T18:00:42Z"config.HEROKU_RELEASE_VERSIONString The identifier for the current release. "v42"config.HEROKU_SLUG_COMMITString The commit hash for the current release. "2c3a0b24069af49b3de35b8e8c26765c1dba9ff0"
Returns Object
Get the server host. Defaults to '0.0.0.0'
Parameters
Returns String
Get the server port. Defaults to '8080'
Parameters
Returns String