GithubHelp home page GithubHelp logo

Comments (8)

fivetanley avatar fivetanley commented on July 19, 2024

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.

kenips avatar kenips commented on July 19, 2024

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.

mikegrassotti avatar mikegrassotti commented on July 19, 2024

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.

fivetanley avatar fivetanley commented on July 19, 2024

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.

kenips avatar kenips commented on July 19, 2024

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.

chrism avatar chrism commented on July 19, 2024

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.

fivetanley avatar fivetanley commented on July 19, 2024

Fixed in 0.3.0! Here's the commit! edaa025

from ember-cli-dotenv.

chrism avatar chrism commented on July 19, 2024

Just installed & it works perfectly - thanks!!

from ember-cli-dotenv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.