remove git hashes for SENTRY_RELEASE

This commit is contained in:
Aaron 2019-01-18 12:33:51 -06:00
parent 5848d33f29
commit 3383c0757b
No known key found for this signature in database
GPG Key ID: 3B5B7597106F0A0E
4 changed files with 10 additions and 17 deletions

View File

@ -8,7 +8,7 @@ SECRET_KEY="not-so-secret"
SENDGRID_API_KEY="optional, but emails won't send without it"
# SENTRY_DSN="https://PUBLICKEY@sentry.io/PROJECTID"
# SENTRY_RELEASE="optional, overrides git hash"
# SENTRY_RELEASE="optional, provides sentry logging with release info"
AWS_ACCESS_KEY_ID=your-user-access-key
AWS_SECRET_ACCESS_KEY=your-user-secret-access-key

View File

@ -10,13 +10,6 @@ import subprocess
from environs import Env
def git_revision_short_hash():
try:
return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'])
except subprocess.CalledProcessError:
return 0
env = Env()
env.read_env()
@ -36,7 +29,7 @@ SENDGRID_API_KEY = env.str("SENDGRID_API_KEY", default="")
SENDGRID_DEFAULT_FROM = "noreply@grant.io"
SENTRY_DSN = env.str("SENTRY_DSN", default=None)
SENTRY_RELEASE = env.str("SENTRY_RELEASE", default=git_revision_short_hash())
SENTRY_RELEASE = env.str("SENTRY_RELEASE", default=None)
MAX_CONTENT_LENGTH = 5 * 1024 * 1024 # 5MB (limits file uploads, raises RequestEntityTooLarge)

View File

@ -10,4 +10,4 @@ BACKEND_URL=http://localhost:5000
# sentry
SENTRY_DSN=https://PUBLICKEY@sentry.io/PROJECTID
SENTRY_RELEASE="optional, overrides git hash"
SENTRY_RELEASE="optional, provides sentry logging with release info"

View File

@ -41,15 +41,15 @@ envProductionRequiredHandler(
'http://localhost:' + (process.env.PORT || 3000),
);
if (!process.env.BACKEND_URL) {
process.env.BACKEND_URL = 'http://localhost:5000';
if (!process.env.SENTRY_RELEASE) {
console.log(
'SENTRY_RELEASE env var is not set, sentry logs will not have release information',
);
process.env.SENTRY_RELEASE = undefined;
}
if (!process.env.SENTRY_RELEASE) {
process.env.SENTRY_RELEASE = childProcess
.execSync('git rev-parse --short HEAD')
.toString()
.trim();
if (!process.env.BACKEND_URL) {
process.env.BACKEND_URL = 'http://localhost:5000';
}
const appDirectory = fs.realpathSync(process.cwd());