What are the other heroku environment variables?

∥☆過路亽.° 提交于 2019-12-20 09:48:04

问题


When setting up a server, I noticed that the environment variable process.env.PORT is used. Are there any other variables like this? Where can I see all of them?


回答1:


The following command will display all of the environment variables, not just those visible from heroku config:

heroku run printenv



回答2:


heroku config does not show PORT. So, it's incomplete if you need everything. This will create a one-off dyno and show everything.

From here: https://devcenter.heroku.com/articles/getting-started-with-nodejs#console

Run a console in a one-off dyno, then at the > prompt, type "console.log(process.env)":

$ heroku run node
Running `node` attached to terminal... up, run.4778
> console.log(process.env
... )
{ BUILDPACK_URL: 'https://github.com/MichaelJCole/heroku-buildpack-nodejs.git#wintersmith',
  TERM: 'xterm',
  SENDGRID_USERNAME: 'unicorns@heroku.com',
  COLUMNS: '80',
  DYNO: 'run.4778',
  PATH: '/app/bin:/app/node_modules/.bin:bin:node_modules/.bin:/usr/local/bin:/usr/bin:/bin',
  PWD: '/app',
  PS1: 'fairydust',
  LINES: '22',
  SHLVL: '1',
  HOME: '/app',
  SENDGRID_PASSWORD: 'ponies',
  PORT: '52031',
  _: '/app/bin/node' }
undefined



回答3:


The command is

heroku config

You can read more here https://devcenter.heroku.com/articles/config-vars




回答4:


See https://devcenter.heroku.com/articles/config-vars: there's a command that appears to tell you what your environment variables are.

$ heroku config

See if that works for you.

EDIT: it appears the heroku docs linked above are wrong. Try this:

$ heroku config -s --app <appname>


来源:https://stackoverflow.com/questions/10185353/what-are-the-other-heroku-environment-variables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!