Skip to content

Commit cc3ee90

Browse files
committed
Expose dsn_env function
1 parent 0b106b7 commit cc3ee90

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/sentry/client.ex

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ defmodule Sentry.Client do
2121
"""
2222
@spec send_event(%Event{}) :: {:ok, String.t} | :error
2323
def send_event(%Event{} = event) do
24-
{endpoint, public_key, secret_key} = parse_dsn!(Application.fetch_env!(:sentry, :dsn))
24+
{endpoint, public_key, secret_key} = dsn_env |> parse_dsn!
2525

2626
auth_headers = authorization_headers(public_key, secret_key)
2727
body = Poison.encode!(event)
@@ -31,6 +31,13 @@ defmodule Sentry.Client do
3131
end)
3232
end
3333

34+
def dsn_env do
35+
case Application.get_env(:sentry, :dsn) do
36+
{:system, env_var} -> System.get_env(env_var)
37+
value -> value
38+
end
39+
end
40+
3441
defp try_request(method, url, headers, body) do
3542
do_try_request(method, url, headers, body, 1)
3643
end

0 commit comments

Comments
 (0)