Skip to content

Commit 33669af

Browse files
Merge pull request #201 from getsentry/do-not-require-enable-source-code
do not require enable_source_code_context configuration
2 parents a3273ef + 1fded6e commit 33669af

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
@@ -44,10 +44,6 @@ Required settings
4444

4545
The DSN provided by Sentry.
4646

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

5349
This is only required if ``enable_source_code_context`` is enabled. Should generally be set to ``File.cwd!``.
@@ -112,6 +108,10 @@ Optional settings
112108

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

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

117117
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)