Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using process.env vars in Ember

This may be a dumb question, but how to get access to process.env vars inside of my ember app? I tried to access process.env in one of my controllers, but I received an error that process was not defined.

like image 730
fentech Avatar asked May 04 '19 03:05

fentech


1 Answers

You generally don't have access to process.env since this is node.js global variable and ember.js generally runs in the browser which will not have process.env

However, you can use process.env during the build process which will produce ember app with the env variables build-in which you can access in another way.

I'm not sure what tooling you are using but here is how it works in Ember CLI Deploy:

http://ember-cli-deploy.com/docs/v1.0.x/using-env-for-secrets/

And here is an example with webpack:

https://webpack.js.org/guides/environment-variables/

like image 60
sensor Avatar answered Nov 01 '22 09:11

sensor