GithubHelp home page GithubHelp logo

Comments (5)

lolmaus avatar lolmaus commented on August 19, 2024 3

What I want is:

  1. Though I strongly believe in decoupling build environment from deploy target, I want each environment to be associated with a specific deploy target by default, unless overridden by hand.
  2. I want to have one source of truth for selecting environment.

I don't want to end up doing

DOTENV_FILE=production EMBER_ENV=production ember deploy production

and then check for process.env.DEPLOY_TARGET (in ember-cli-build.js, config/environment.js or index.js of in-repo addons), as ember-cli-deploy recommends.

There is clearly a need for ember-cli-dotenv, ember-cli-deploy and ember-cli teams to sync up.

from ember-cli-dotenv.

jeremyhaile avatar jeremyhaile commented on August 19, 2024 1

I just spent a lot of time trying to understand why env was development while I was running ember deploy production. The default behavior is quite unintuitive, especially given that I imagine a primary use of this gem is for production secrets that should be available during a deploy.

from ember-cli-dotenv.

SergeAstapov avatar SergeAstapov commented on August 19, 2024

@lolmaus unfortunately with Ember CLI >= 2.16 we can not rely on environment detection made by Ember CLI: we have to initialize dotenv configs at init stage of addon in order to make environment variables available at config stage.
included hook is to late for that as discussed in #30.

I'm personally in favor of using DOTENV_FILE env var and make it supported by addon itself instead of hardcoding ember-cli-deploy commands.
DOTENV_FILE=.env.prod ember deploy prod seems to be completely fine approach as it should be setup on CI. In case of smaller projects without CI - it can be scripted, e.g. into package.json like npm run deploy-prod

@fivetanley @jasonmit thoughts?

from ember-cli-dotenv.

lolmaus avatar lolmaus commented on August 19, 2024

instead of hardcoding ember-cli-deploy commands

Well, we're already doing this:

    // Is it "ember test" or "ember t" command without explicit env specified?
    if (!env && (process.argv.indexOf('test') > -1 || process.argv.indexOf('t') > -1)) {
      env = 'test'
    }

https://github.com/fivetanley/ember-cli-dotenv/blob/2.0.0/index.js#L58-L61

from ember-cli-dotenv.

jasonmit avatar jasonmit commented on August 19, 2024

I want to have one source of truth for selecting environment. I don't want to end up doing DOTENV_FILE=production EMBER_ENV=production ember deploy production

_resolveEnvironment is needed because of an upstream bug where the build target is unknown at the time we need it. We parse all the internal commands if EMBER_ENV is unset. Which is why I'm adamant in not adding custom arg parsing logic that would couple us to ember deploy's deploy target arg. At the end of the day, _resolveEnvironment should only ever return what would expect from the EmberApp instances env fn and the goal is to remove it entirely when the upstream bug is resolved.

ec-dotenv's default config file lookup strategy is centered around the EmberEnv when looking for the builds associated dotenv file. For most, that's sufficient. For you, and maybe others, you need the ability to override - which is possible as you already know.

Short or writing our own plugin architecture (total overkill), you can write an ec-deploy plugin that sets process.env.DOTENV_FILE. As long as that happens before our init hook, you would achieve what it is you're after.

I'm personally in favor of using DOTENV_FILE env var and make it supported by addon itself instead of hardcoding ember-cli-deploy commands.

👍 @SergeAstapov

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.