How do I access the current Heroku release version programmatically?

后端 未结 5 1625
一整个雨季
一整个雨季 2021-02-18 19:22

Is this even possible - is there something like a RELEASE_VERSION environment variable?

5条回答
  •  时光取名叫无心
    2021-02-18 19:59

    There is now a released Heroku Labs feature called Dyno Metadata that gives you this information. Once you enable it, your running dyno's environment will contain environment variables with the Heroku version ID of your app, the git commit hash from which your release slug was built, and much more. For example:

    HEROKU_APP_ID:                   9daa2797-e49b-4624-932f-ec3f9688e3da
    HEROKU_APP_NAME:                 example-app
    HEROKU_DYNO_ID:                  1vac4117-c29f-4312-521e-ba4d8638c1ac
    HEROKU_RELEASE_VERSION:          v42
    HEROKU_SLUG_COMMIT:              2c3a0b24069af49b3de35b8e8c26765c1dba9ff0
    HEROKU_SLUG_DESCRIPTION:         Deploy 2c3a0b2
    

提交回复
热议问题