What are the other heroku environment variables?

前端 未结 4 1902
萌比男神i
萌比男神i 2020-12-28 12:50

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?

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-28 13:18

    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
    

提交回复
热议问题