Skip to content

Breaking changes to meaning of environment #7980

Closed

Description

@ef4

The new feature that allows you to put environment variables in .ember-cli has some very surprising side effects:

  1. At runtime, require('your-app/config/environment').default.environment changes from a string like "development" to a POJO containing the settings from your .ember-cli.

  2. Custom ember-cli commands that previously accepted their own option named environment are now getting stomped with the settings from .ember-cli. Here is an example of a command that breaks if you try to use the new feature.

Activity

  1. ef4 commented on Aug 16, 2018

    @ef4
    ContributorAuthor

    So this has got to be a bug:

    process.env.EMBER_ENV = process.env.EMBER_ENV || this.environment;

    When you're using this feature, the EmberApp's env is "[object Object]"

    That is what causes point number 1 above. Point number 2 is maybe legitimate, if surprising. It seems that your .ember-cli is allowed to provide defaults for any command line argument.

  2. ef4 commented on Aug 16, 2018

    @ef4
    ContributorAuthor

    After more digging, these two issues are one-in-the-same, because the build command itself is getting its environment stomped here:

    run(commandOptions) {

    It used to receive { environment: 'development' } in the commandOptions, now it will get your POJO.

  3. knownasilya commented on Aug 16, 2018

    @knownasilya
    Contributor

    I'm surprised no tests caught this issue..

  4. rwjblue commented on Aug 31, 2018

    @rwjblue
    Member

    Indeed.

  5. rwjblue commented on Aug 31, 2018

    @rwjblue
    Member

    We should revert ASAP, and bring back the feature with more test coverage.

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