Comments (8)
Nope! You should just have to install it using the instructions on the README, and they should be available there.
As for using in your config/environment.js
file, I think a good solution might be to use dotenv.load
which would put the environment variables on the node process environment variable, so for example, you could use it this way in your config/environment.js
:
module.exports = function(env){
var ENV = {};
ENV.APP.X = process.env.X;
};
Would that work for you?
from ember-cli-dotenv.
That's interesting, because I wasn't able to get it to work without calling dotenv.load
, Now I have something like:
ENV.X = process.env.X || "myX"
so that I can get dotenv to work and fallback to "myX" when not set.
As for ENV.APP.X
(which I actually meant setting anything inside ENV.APP so it could be ENV.APP.A, ENV.APP.B, etc), I think I'm asking too much. Doing so requires storing JSON in an env variable, which I don't think makes sense at all. Thanks tho!
from ember-cli-dotenv.
Not working for me either, and wondering what you guys mean by "calling dotenv.load
"? Are you calling that from environment.js
somehow?
from ember-cli-dotenv.
Right now it doesn't work in environment.js when run from node, but should work in your app. Do you need it to work in environment.js (which is run before the app assets are even built)?
I just want to make sure that's the use case for both of the comments... I wonder if it is possible for us to get into the process environment variables before ember-cli gets to this file. I can look into it this sunday, but if someone wants to start trying stuff, you could move require('dotenv').load() to the top of this file https://github.com/fivetanley/ember-cli-dotenv/blob/master/index.js#L7
Would love to merge a PR on this, but I can try to get to it this weekend.
from ember-cli-dotenv.
That's indeed my original intent @fivetanley. It's much more useful to be able to access ENV inside environment.js for setting fallbacks.
from ember-cli-dotenv.
This library looks great, but being able to access the variables in config/environment.js
is one of the main use cases for me.
Many of the keys i'd like to keep out of the repo are required in config/environment.js
ie for authentication services like Torii.
Rails has the Figaro gem which I think includes some great features & even allows you to set all the variables directly on heroku by calling figaro heroku:set -e production
from ember-cli-dotenv.
Fixed in 0.3.0! Here's the commit! edaa025
from ember-cli-dotenv.
Just installed & it works perfectly - thanks!!
from ember-cli-dotenv.
Related Issues (20)
- FastBoot support HOT 10
- Picking a specific dotenv file via CLI param HOT 2
- Installing gives errors somekey is not defined
- ignore exports in variable defs HOT 1
- Make .env.production effective on ember s -prod HOT 1
- This addon is incompatible with [email protected]+ HOT 47
- Unable to install v2.0 HOT 2
- Ability to check for variable presence HOT 5
- `config/dotenv.js` does not respect environment assumed from `ember deploy prod` HOT 5
- Release a new version to npm? HOT 1
- path option doesn't behave well with ember-cli-deploy's development workflow HOT 9
- Started getting this.ui.warn error since yesterday HOT 1
- Installation fails with "Cannot read property 'clientAllowedKeys' of undefined" HOT 5
- Travis missing ENV vars HOT 2
- Use failOnMissingKey in CI build HOT 5
- The default lookup path of .env is not documented HOT 2
- Environment not recognized correctly while using ember build --prod HOT 2
- Fix CI HOT 1
- env vars not loaded in `.ember-cli.js` HOT 1
- Use for local development only HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-cli-dotenv.