<commit_before>[![Build Status](https://travis-ci.org/fivetanley/ember-cli-dotenv.svg)](https://travis-ci.org/fivetanley/ember-cli-dotenv)
# Ember CLI Dotenv

# Installation

`ember install ember-cli-dotenv`

# 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:

```bash
DROPBOX_KEY=YOURKEYGOESHERE
```

Next, put some configuration in your `ember-cli-build.js`. Starting in 0.2.0, *client side keys must be explicitly allowed*:

```javascript
// ember-cli-build.js

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
    dotEnv: {
      clientAllowedKeys: ['DROPBOX_KEY']
    }
  });

  return app.toTree();
};
```

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

```javascript
// 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.**

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

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

console.log(ENV.DROPBOX_KEY); // logs YOURKEYGOESHERE
```

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

All the work is done by ember-cli and [dotenv][dotenv]. Thanks ember-cli team and
dotenv authors and maintainers! Thanks <NAME> 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:
<commit_msg>Security clarification<commit_after>[![Build Status](https://travis-ci.org/fivetanley/ember-cli-dotenv.svg)](https://travis-ci.org/fivetanley/ember-cli-dotenv)
# Ember CLI Dotenv

# Installation

`ember install ember-cli-dotenv`

# 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:

```bash
DROPBOX_KEY=YOURKEYGOESHERE
```

Next, put some configuration in your `ember-cli-build.js`. Starting in 0.2.0, *client side keys must be explicitly allowed*:

```javascript
// ember-cli-build.js

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
    dotEnv: {
      clientAllowedKeys: ['DROPBOX_KEY']
    }
  });

  return app.toTree();
};
```

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

```javascript
// 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.

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

console.log(ENV.DROPBOX_KEY); // logs YOURKEYGOESHERE
```

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

All the work is done by ember-cli and [dotenv][dotenv]. Thanks ember-cli team and
dotenv authors and maintainers! Thanks <NAME> 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:

{'fraction_non_alphanumeric': 0.09692773691042839, 'fraction_numerical': 0.0012981393336218088, 'mean_word_length': 4.497027348394768, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2691610', 'n_tokens_mistral': 1398, 'n_tokens_neox': 1356, 'n_words': 544}