Comments (5)
What I want is:
- 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.
- 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.
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.
@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.
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.
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.
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
- 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.