Let's say I have a Rails application deployed on Heroku. How can I display these pieces of information in my views?
Heroku sets an environment variable with the commit hash ENV['COMMIT_HASH']
.
As for the timestamp, you could hit the github api with the hash if you host your code there. Looks like the ruby-github gem can help you with this, or you could do it yourself with HTTParty.
The reason for this is because when your app is deployed onto the dyno grid to serve requests, it's compiled into a "slug" for fast deployment, and this slug doesn't have the git repo with it anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With