Skip to content

Define ENV variables in .ember-cli #7896

Closed

Description

@gossi

It can become tedious to prefix every command with the correct environment variables over and over again. At the moment for example if you have an experiment running, you have to prefix the ember command with that experiment name, e.g. EMBER_CLI_MODULE_UNIFICATION=true ember serve.

As those ENV variables depend on their project, it makes most sense to define them once for that project and use ember commands as usual. .ember-cli looks like a good place for me to define them and could look like this:

{
  "disableAnalytics": false,
  "EMBER_CLI_MODULE_UNIFICATION": true
};

or be more explicit:

{
  "disableAnalytics": false,
  "ENV": {
    "EMBER_CLI_MODULE_UNIFICATION": true
  }
};

Alternatively read in a .env file(s) where variables can be defined. There is kind of a standard here I guess? Which is used by CI/CD services. I haven't run enough research on this one to make a clear statement other than "more research needed".

Activity

  1. astronomersiva commented on Jul 11, 2018

    @astronomersiva
    Contributor

    +1 to this. I have been running a module unification project myself and this often gets in the way.

    I feel .ember-cli is the right place for this as .env files are generally ignored in source control. There can be an experiments field in the .ember-cli file that we can make use of here.

    I am willing to work on this if this seems reasonable.

    cc: @rwjblue

  2. stefanpenner commented on Jul 11, 2018

    @stefanpenner
    Contributor

    I feel .ember-cli is the right place for this as .env files are generally ignored in source control. There can be an experiments field in the .ember-cli file that we can make use of here.

    Sounds reasonable to me.

  3. gossi commented on Nov 14, 2018

    @gossi
    Author

    Solution is in #8157

  4. locks commented on Feb 10, 2022

    @locks
    Contributor

    Fix has been merged!

  5. btecu commented on Feb 10, 2022

    @btecu
    Contributor

    It looks like it got reverted: #8008.

  6. locks commented on Feb 10, 2022

    @locks
    Contributor

    Hm, it looks like it was. Thanks for the link! I think I'll keep the issue closed for a couple of reasons. One is that module unification has been dropped for a long time, the other is that usage of dotenv is widespread and that seems like a better solution than putting more functionality into .ember-cli.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions