From 32ca7b6e7645205596e057620fae61a18e2eef56 Mon Sep 17 00:00:00 2001 From: Jeremy Green Date: Mon, 16 Dec 2024 12:43:15 -0600 Subject: [PATCH] Improve Heroku Detection (#1813) We can use app.json to set an environment variable for apps deployed in Heroku. This is kind of the "first line of defense" for detecting that we're in Heroku. We'll also fallback to some other methods. When the `BT_IS_IN_HEROKU` ENV var is set to `true` we'll assume that we're running in Heroku, and we'll sidestep any other detection methods. We'll still fallback to our previous detection methods if that ENV var does not exist. This also allows apps _not_ in Heroku to negate a false positive detection by our fallback methods by setting the `BT_IS_IN_HEROKU` ENV var to `false`. --- app.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app.json b/app.json index 087b5af3e..a86522305 100644 --- a/app.json +++ b/app.json @@ -33,6 +33,10 @@ "description": "Supply the fully-qualified URL for this Heroku app, e.g. `https://your-app.herokuapp.com`. You'll update this later after configuring a custom domain.", "value": "https://ENTER_YOUR_APP_NAME_HERE.herokuapp.com" }, + "BT_IS_IN_HEROKU": { + "description": "We use this to tweak some run-time settings when we know we're running the app in Heroku. Don't change it!", + "value": "true" + }, "FONTAWESOME_NPM_AUTH_TOKEN": { "description": "We recommend using Font Awesome Pro for icons. To use it, fetch your token from `https://fontawesome.com/how-to-use/on-the-web/setup/using-package-managers` and enter it here.", "required": false