Ember CLI:为暂存构建
Ember CLI: Build for staging
我想为暂存环境创建 Ember CLI 应用程序的构建。对于暂存,我想基本上做与生产完全相同的事情(缩小、指纹识别、排除测试等),但想要选择环境变量进行开发。为此,我更改了我的 environment.js
文件以说明分段:
if (environment === 'development' || environment === 'staging') {
ENV.someApiKey = 'test-api-key';
}
if (environment === 'production') {
ENV.someApiKey = 'production-api-key';
}
当我 运行 ember build --environment=staging
时,设置了正确的暂存环境变量,但是 运行 用于生产的所有其他构建过程都没有。有没有办法告诉 Ember CLI 为生产构建而为开发选择环境变量?
Ember 根据是否在 /ember-cli/lib/broccoli/ember-app.js 中指定了 production ONLY 来设置标志:
var isProduction = this.env === 'production';
然后它使用特定于生产的设置。
因此,如果您想进行暂存构建,请在 运行 ember 构建之前使用流程修改 environment.js,然后在构建完成后将文件恢复为正常.我们可能应该在未来使这个过程更加灵活。
我想为暂存环境创建 Ember CLI 应用程序的构建。对于暂存,我想基本上做与生产完全相同的事情(缩小、指纹识别、排除测试等),但想要选择环境变量进行开发。为此,我更改了我的 environment.js
文件以说明分段:
if (environment === 'development' || environment === 'staging') {
ENV.someApiKey = 'test-api-key';
}
if (environment === 'production') {
ENV.someApiKey = 'production-api-key';
}
当我 运行 ember build --environment=staging
时,设置了正确的暂存环境变量,但是 运行 用于生产的所有其他构建过程都没有。有没有办法告诉 Ember CLI 为生产构建而为开发选择环境变量?
Ember 根据是否在 /ember-cli/lib/broccoli/ember-app.js 中指定了 production ONLY 来设置标志:
var isProduction = this.env === 'production';
然后它使用特定于生产的设置。
因此,如果您想进行暂存构建,请在 运行 ember 构建之前使用流程修改 environment.js,然后在构建完成后将文件恢复为正常.我们可能应该在未来使这个过程更加灵活。