javascript - Why does sails.js ignore /config/env/production.js and use process.env.PORT instead? -
i've set port 8080 in /config/env/production.js , set environmental variable node_env production. however, when lifted sails, ever got launch @ port 8000. realized set port environmental variable , right result, i'd prefer use normal config files. have no local.js configuration file, that's not overwriting. doing wrong?
[15:12:50] nodejs @ myserver : /apps/myapi/ $ cat config/env/production.js /** * production environment settings * * file can include shared settings production environment, * such api keys or remote database passwords. if you're using * version control solution sails app, file * committed repository unless add .gitignore * file. if repository publicly viewable, don't add * private information file! * */ module.exports = { /*************************************************************************** * set default database connection models in production * * environment (see config/connections.js , config/models.js ) * ***************************************************************************/ // models: { // connection: 'somemysqlserver' // }, /*************************************************************************** * set port in production environment 80 * ***************************************************************************/ port: 8080, /*************************************************************************** * set log level in production environment "silent" * ***************************************************************************/ // log: { // level: "silent" // } }; [15:13:09] nodejs @ myserver : /apps/myapi/ $ sails lift starting app... warning: connect.session() memorystore not designed production environment, leak memory, , not scale past single process. warning: connect.session() memorystore not designed production environment, leak memory, , not scale past single process. .-..-. sails <| .-..-. v0.11.2 |\ /|.\ / || \ ,' |' \ .-'.-==|/_--' `--'-------' __---___--___---___--___---___--___ ____---___--___---___--___---___--___-__ server lifted in `/apps/myapi` see app, visit http://localhost:8000 shut down sails, press <ctrl> + c @ time. -------------------------------------------------------- :: thu oct 15 2015 15:13:21 gmt+0800 (hkt) environment : production port : 8000 -------------------------------------------------------- ^c [15:15:20] nodejs @ myserver : /apps/myapi/ $ export port=8080 [15:15:41] nodejs @ myserver : /apps/myapi/ $ sails lift starting app... warning: connect.session() memorystore not designed production environment, leak memory, , not scale past single process. warning: connect.session() memorystore not designed production environment, leak memory, , not scale past single process. .-..-. sails <| .-..-. v0.11.2 |\ /|.\ / || \ ,' |' \ .-'.-==|/_--' `--'-------' __---___--___---___--___---___--___ ____---___--___---___--___---___--___-__ server lifted in `/apps/myapi` see app, visit http://localhost:8080 shut down sails, press <ctrl> + c @ time. -------------------------------------------------------- :: thu oct 15 2015 15:15:48 gmt+0800 (hkt) environment : production port : 8080 --------------------------------------------------------
turns out there .env file in parent directory automatically setting port environment variable (even if unset it). guess makes sense sails respect environment variable on /config/production.js in case.
Comments
Post a Comment