如何将环境变量从bashrc传递到Ember CLI.我想象你需要条带api键或pusher api-keys的情况,你可以在bashrc中的环境变量中使用它们.如何将api-key传递给Ember CLI.
我尝试process.env在brocfile.js和中使用Node.js environment.js,但是当我尝试在Ember JS控制器中访问它时,属性为null.
在我的environment.js文件中,我添加了,
APP: { apiKey: process.env.KEY }
Run Code Online (Sandbox Code Playgroud)
在我的Ember JS控制器中,我尝试访问它:
import config from '../config/environment';
Run Code Online (Sandbox Code Playgroud)
并设置lkey如下所示的控制器属性,这不起作用:
lkey: config.App.KEY
Run Code Online (Sandbox Code Playgroud)
接下来brocfile.js,我补充说:
var limaKey = process.env.Key;
var app = new EmberApp({key: limaKey});
Run Code Online (Sandbox Code Playgroud)
这仍然无效.