Sentry: delete an empty SENTRY_DSN from the environment

61728f8 · Gabe Morell · 2026-10-27 15:44

2 files +7 -7
Message
{commit_body(@commit)}

Files changed

modified config/runtime.exs
+7 −7
@@ -72,14 +72,14 @@ if config_env() == :prod do
72 72
73 73 # Sentry: only emits when DSN is non-empty, so the secret can be left
74 74 # blank (or absent) in environments where reporting is off.
75 + # "" counts as unset: Sentry rejects dsn: "" at boot rather than
76 + # treating it as off, and the application refuses to start. Deleted
77 + # from the environment, not just the config: whenever dsn is nil,
78 + # Sentry reads SENTRY_DSN itself as it starts, after this file runs.
79 + if System.get_env("SENTRY_DSN") == "", do: System.delete_env("SENTRY_DSN")
80 +
75 81 config :sentry,
76 − # "" counts as unset: Sentry rejects dsn: "" at boot rather than
77 − # treating it as off, and the application refuses to start.
78 − dsn:
79 − (case System.get_env("SENTRY_DSN") do
80 − "" -> nil
81 − dsn -> dsn
82 − end),
82 + dsn: System.get_env("SENTRY_DSN"),
83 83 environment_name: :prod,
84 84 release: System.get_env("APP_VERSION") || System.get_env("CI_COMMIT_SHA")
85 85

Parents: 54b8cdb