Quantcast
Viewing all articles
Browse latest Browse all 4826

How do I reference config/environment.js in a plain old JS file?

@pacific202 wrote:

The Guide provides an example in ES6 for reading variables out of the environment.js file:

https://guides.emberjs.com/v2.5.0/configuring-ember/configuring-your-app/

However, I want to use one of the values in ENV.APP in a plain old .js file. Specifically, I want to dynamically set an http-proxy target server depending on the environment.

In /server/proxies/api.js I added this code at the top:

var proxyConfig = require('./../../config/environment.js');
console.log( 'Proxy Config: ' + JSON.stringify(proxyConfig, null, 2) );

I get this as the output:

Proxy Config: undefined

How can I access ENV.APP settings in regular JavaScript files?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4826

Trending Articles