Dotenv for your ember app through ember-cli
JavaScript HTML CSS
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
blueprints/ember-cli-dotenv Move dotenv.js config file to /config folder Nov 5, 2017
test Remove chai-fs devDependency as it's not used Nov 13, 2017
.ember-cli first commit Oct 16, 2014
.env load secrets into node’s process.env Nov 11, 2014
.gitignore Removed exists-sync pkg, using fs.existsSync instead Nov 9, 2017
.watchmanconfig Upgrade Addon via `ember init` command Oct 18, 2015 Update changelog for 2.0 version Nov 13, 2017 Upgrade Addon via `ember init` command Oct 18, 2015
ember-cli-build.js Upgrade Ember CLI and align with default blueprint Oct 26, 2017
package.json 2.1.0 Mar 13, 2018
yarn.lock Upgrade ember-cli-addon-tests to version 0.11 Nov 14, 2017

Build Status npm version Ember Observer Score

Ember CLI Dotenv


ember install ember-cli-dotenv

Upgrading to 2.0.0

  • ember install ember-cli-dotenv@^2.0.0
  • open config/dotenv.js and ember-cli-build.js
  • Move/convert the dotEnv application options from ember-cli-build.js to the function declared within config/dotenv.js

What is Ember CLI Dotenv?

This addon allows you to write environment variables in a .env file and expose them to your Ember app through the built-in config/environment.js that you can import in your app. For example, you might be building an app with Dropbox and don’t want to check your key into the repo. Put a .env file in the root of your repository:


Next, configure config/dotenv.js.

// config/dotenv.js
module.exports = function(env) {
  return {
    clientAllowedKeys: ['DROPBOX_KEY'],
    // Fail build when there is missing any of clientAllowedKeys environment variables.
    // By default false.
    failOnMissingKey: false, 

All keys in .env are currently injected into node’s process.env. These will be available in your config/environment.js file:

// config/environment.js
module.exports = function(environment) {
  return {
    MY_OTHER_KEY: process.env.MY_OTHER_KEY

You can then use the node process environment variables in other ember-cli-addons, such as express middleware or other servers/tasks.

Security: environment variables in config/environment.js are never filtered unlike using .env and clientAllowedKeys. Remember to use the environment variable passed into your config function to filter out secrets for production usage. Never include sensitive variables in clientAllowedKeys, as these will be exposed publicly via ember's <meta name="app/config/environment"> tag.

then, you can access the environment variables anywhere in your app like you usually would.

import ENV from "my-app/config/environment";


You can read more about dotenv files on their dotenv repository.

All the work is done by ember-cli and dotenv. Thanks ember-cli team and dotenv authors and maintainers! Thanks Brandon Keepers for the original dotenv ruby implementation.

Multiple Environments

Sometime people may want to use different .env file than the one in project root. This can be configured as below:

// config/dotenv.js
module.exports = function(env) {
  return {
    clientAllowedKeys: ['DROPBOX_KEY'],
    path: './path/to/.env'

In addition, you may also customize for different environments:

// config/dotenv.js
module.exports = function(env) {
  return {
    clientAllowedKeys: ['DROPBOX_KEY'],
    path: `./path/to/.env-${env}`

With the above, if you run ember build --environment production, the file ./path/to/.env-production will be used instead.


This addon supports the Ember 2.x series, but it is also backwards-compatible down to Ember-CLI 0.1.2 and Ember 1.7.0.

Other Resources

Development Installation

  • git clone this repository
  • npm install
  • bower install


Running Tests

  • npm test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server


  • ember build

For more information on using ember-cli, visit