Configuring Your App

Configuring Your App

Ember CLI ships with support for managing your application's environment. Ember CLI will setup a default environment config file at config/environment. Here, you can define an ENV object for each environment, which are currently limited to three: development, test, and production.

The ENV object contains three important keys:

  • EmberENV can be used to define Ember feature flags (see the Feature Flags guide).
  • APP can be used to pass flags/options to your application instance.
  • environment contains the name of the current environment (development,production or test).

You can access these environment variables in your application code by importing from your-application-name/config/environment.

For example:

import ENV from 'your-application-name/config/environment';

if (ENV.environment === 'development') {
  // ...
}

© 2017 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://guides.emberjs.com/v2.13.0/configuring-ember/configuring-your-app

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部