Skip to content

Commit e96d362

Browse files
Revert "fix(dev): Do not export SENTRY_DSN in .envrc (#33802)"
This reverts commit adac2e4.
1 parent 0399f61 commit e96d362

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

.envrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ report_to_sentry() {
5959
curl -sL https://sentry.io/get-cli/ | bash
6060
fi
6161
# Report to sentry-dev-env project
62-
SENTRY_DSN="https://[email protected]/5723503" \
63-
sentry-cli send-event -m "$error_message" --logfile "$_SENTRY_LOG_FILE" --level $log_level
62+
sentry-cli send-event -m "$error_message" --logfile "$_SENTRY_LOG_FILE" --level $log_level
6463
rm "$_SENTRY_LOG_FILE"
6564
}
6665

@@ -143,6 +142,8 @@ fi
143142
if [ -n "${SENTRY_DEVENV_NO_REPORT+x}" ]; then
144143
debug "No development environment errors will be reported (since you've defined SENTRY_DEVENV_NO_REPORT)."
145144
else
145+
# This is necessary for the bash-hook in lib.sh to work
146+
export SENTRY_DSN="https://[email protected]/5723503"
146147
# Since direnv traps the EXIT signal we place the temp file under /tmp for the odd time
147148
# the script will use the EXIT path
148149
_SENTRY_LOG_FILE=$(mktemp /tmp/sentry.envrc.$$.out || mktemp /tmp/sentry.envrc.XXXXXXXX.out)

config/hooks/pre-commit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ if sys.version_info.major < 3:
1616
try:
1717
import sentry_sdk
1818

19-
if not os.environ.get("SENTRY_DEVENV_NO_REPORT"):
20-
sentry_sdk.init(dsn="https://[email protected]/5723503")
19+
if os.environ.get("SENTRY_DSN"):
20+
sentry_sdk.init(dsn=os.environ["SENTRY_DSN"])
2121
else:
2222
sys.stdout.write(
2323
"WARNING: Errors in this file will not be reported to Sentry since SENTRY_DSN is not set.\n"

scripts/lib.sh

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,6 @@ if [ -z "${CI+x}" ]; then
1414
green="$(tput setaf 2)"
1515
yellow="$(tput setaf 3)"
1616
reset="$(tput sgr0)"
17-
if [ -z "${SENTRY_DEVENV_NO_REPORT+x}" ]; then
18-
sentry_cli_major_version="$(sentry-cli --version | awk '{print $2}' | sed 's/\([0-9]*\).*/\1/')"
19-
# XXX: Until we support version 2.x
20-
if [ $sentry_cli_major_version -lt 2 ]; then
21-
# sentry-dev-env project
22-
export SENTRY_DSN="https://[email protected]/5723503"
23-
eval "$(sentry-cli bash-hook)"
24-
else
25-
echo "You are using the latest major release of sentry-cli."
26-
echo "${yellow}Please remove it and we will install the correct version: rm $(which sentry-cli)${reset}"
27-
exit 1
28-
fi
29-
fi
3017
fi
3118

3219
venv_name=".venv"
@@ -46,6 +33,15 @@ configure-sentry-cli() {
4633
# XXX: Temporary install version 1.74.3 until we upgrade to version 2.x
4734
curl -sL https://gist.githubusercontent.com/armenzg/96481b0b653ecf807900373f5af09816/raw/caf5695e0eb6c214ec84f9fc217965aec928acc0/get-cli.sh | bash
4835
fi
36+
sentry_cli_major_version="$(sentry-cli --version | awk '{print $2}' | sed 's/\([0-9]*\).*/\1/')"
37+
# XXX: Until we support version 2.x
38+
if [ $sentry_cli_major_version -lt 2 ]; then
39+
eval "$(sentry-cli bash-hook)"
40+
else
41+
echo "You are using the latest major release of sentry-cli."
42+
echo "${yellow}Please remove it and we will install the correct version: rm $(which sentry-cli)${reset}"
43+
exit 1
44+
fi
4945
fi
5046
}
5147

0 commit comments

Comments
 (0)