Skip to content

Commit 1fded6e

Browse files
committed
do not require enable_source_code_context configuration
1 parent f2c942c commit 1fded6e

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ end
8484
| `sample_rate` | False | 1.0 | |
8585
| `in_app_module_whitelist` | False | `[]` | |
8686
| `report_deps` | False | True | Will attempt to load Mix dependencies at compile time to report alongside events |
87-
| `enable_source_code_context` | True | | |
87+
| `enable_source_code_context` | False | False | |
8888
| `root_source_code_path` | Required if `enable_source_code_context` is enabled | | Should generally be set to `File.cwd!`|
8989
| `context_lines` | False | 3 | |
9090
| `source_code_exclude_patterns` | False | `[~r"/_build/", ~r"/deps/", ~r"/priv/"]` | |

docs/config.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ Required settings
4343

4444
The DSN provided by Sentry.
4545

46-
.. describe:: enable_source_code_context
47-
48-
When true, Sentry will read and store source code files to report the source code that caused an exception.
49-
5046
.. describe:: root_source_code_path
5147

5248
This is only required if ``enable_source_code_context`` is enabled. Should generally be set to ``File.cwd!``.
@@ -111,6 +107,10 @@ Optional settings
111107

112108
Will attempt to load Mix dependencies at runtime to report alongside events. Defaults to `true`.
113109

110+
.. describe:: enable_source_code_context
111+
112+
When true, Sentry will read and store source code files to report the source code that caused an exception.
113+
114114
.. describe:: context_lines
115115

116116
The number of lines of source code before and after the line that caused the exception to be included. Defaults to ``3``.

lib/sentry/config.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ defmodule Sentry.Config do
5555
get_config(:client, default: Sentry.Client, check_dsn: false)
5656
end
5757

58+
def enable_source_code_context do
59+
get_config(:root_source_code_path, default: false, check_dsn: false)
60+
end
61+
5862
def root_source_code_path do
5963
path = get_config(:root_source_code_path)
6064

lib/sentry/event.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ defmodule Sentry.Event do
3535
@type t :: %__MODULE__{}
3636

3737
alias Sentry.{Event, Util, Config}
38-
@source_code_context_enabled Application.fetch_env!(:sentry, :enable_source_code_context)
38+
@source_code_context_enabled Config.enable_source_code_context()
3939
@source_files if(@source_code_context_enabled, do: Sentry.Sources.load_files(), else: nil)
4040

4141
@enable_deps_reporting Config.report_deps()

0 commit comments

Comments
 (0)