config.prod.js value is not being used when NODE_ENV is production.
See original GitHub issueWhen I set the key/value in config.default.js
, it will work in any environment.
If I separated key/value into config.local.js
and config.prod.js
with different value on the same key, it will read the key/value in development
mode just fine, but not in config.prod.js
.
To reproduce it,
// config.local.js
...
rest: {
username: 'matt',
},
...
When I console log the this.app.config.rest.username
inside app/apis/demo.js
* index()
function, I can get the value of ‘matt’. In this case, the value of this.app.env
is development
// config.prod.js
...
rest: {
username: 'matt_prod',
},
...
If I start the server with NODE_ENV=production npm start
, When I console log the this.app.config.rest.username
inside app/apis/demo.js
* index()
function, I can get the value of ‘undefined’. In this case, the value of this.app.env
is production
. So it is not reading the value from config.prod.js
. Also tried with NODE_ENV=prod npm start
. it does not work either.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
something like,
if you want to run Egg server in production mode, you may run a NPM script like this
To start your server in production, try this in terminal
所以这个的结论就是补文档?