Skip to content

Commit 0cd8c86

Browse files
authored
Make all scalar config values configurable through environment variables (#1784)
1 parent 2fc8413 commit 0cd8c86

File tree

1 file changed

+74
-74
lines changed

1 file changed

+74
-74
lines changed

config/debugbar.php

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
'enabled' => env('DEBUGBAR_ENABLED', null),
18-
'hide_empty_tabs' => true, // Hide tabs until they have content
18+
'hide_empty_tabs' => env('DEBUGBAR_HIDE_EMPTY_TABS', true), // Hide tabs until they have content
1919
'except' => [
2020
'telescope*',
2121
'horizon*',
@@ -38,14 +38,14 @@
3838
| Leaving it to null will allow localhost only.
3939
*/
4040
'storage' => [
41-
'enabled' => true,
41+
'enabled' => env('DEBUGBAR_STORAGE_ENABLED', true),
4242
'open' => env('DEBUGBAR_OPEN_STORAGE'), // bool/callback.
43-
'driver' => 'file', // redis, file, pdo, socket, custom
44-
'path' => storage_path('debugbar'), // For file driver
45-
'connection' => null, // Leave null for default connection (Redis/PDO)
46-
'provider' => '', // Instance of StorageInterface for custom driver
47-
'hostname' => '127.0.0.1', // Hostname to use with the "socket" driver
48-
'port' => 2304, // Port to use with the "socket" driver
43+
'driver' => env('DEBUGBAR_STORAGE_DRIVER', 'file'), // redis, file, pdo, socket, custom
44+
'path' => env('DEBUGBAR_STORAGE_PATH', storage_path('debugbar')), // For file driver
45+
'connection' => env('DEBUGBAR_STORAGE_CONNECTION', null), // Leave null for default connection (Redis/PDO)
46+
'provider' => env('DEBUGBAR_STORAGE_PROVIDER', ''), // Instance of StorageInterface for custom driver
47+
'hostname' => env('DEBUGBAR_STORAGE_HOSTNAME', '127.0.0.1'), // Hostname to use with the "socket" driver
48+
'port' => env('DEBUGBAR_STORAGE_PORT', 2304), // Port to use with the "socket" driver
4949
],
5050

5151
/*
@@ -104,7 +104,7 @@
104104
|
105105
*/
106106

107-
'include_vendors' => true,
107+
'include_vendors' => env('DEBUGBAR_INCLUDE_VENDORS', true),
108108

109109
/*
110110
|--------------------------------------------------------------------------
@@ -125,11 +125,11 @@
125125
| You can defer loading the dataset, so it will be loaded with ajax after the request is done. (Experimental)
126126
*/
127127

128-
'capture_ajax' => true,
129-
'add_ajax_timing' => false,
130-
'ajax_handler_auto_show' => true,
131-
'ajax_handler_enable_tab' => true,
132-
'defer_datasets' => false,
128+
'capture_ajax' => env('DEBUGBAR_CAPTURE_AJAX', true),
129+
'add_ajax_timing' => env('DEBUGBAR_ADD_AJAX_TIMING', false),
130+
'ajax_handler_auto_show' => env('DEBUGBAR_AJAX_HANDLER_AUTO_SHOW', true),
131+
'ajax_handler_enable_tab' => env('DEBUGBAR_AJAX_HANDLER_ENABLE_TAB', true),
132+
'defer_datasets' => env('DEBUGBAR_DEFER_DATASETS', false),
133133
/*
134134
|--------------------------------------------------------------------------
135135
| Custom Error Handler for Deprecated warnings
@@ -139,7 +139,7 @@
139139
| in the Messages tab.
140140
|
141141
*/
142-
'error_handler' => false,
142+
'error_handler' => env('DEBUGBAR_ERROR_HANDLER', false),
143143

144144
/*
145145
|--------------------------------------------------------------------------
@@ -150,7 +150,7 @@
150150
| Extension, without the server-side code. It uses Debugbar collectors instead.
151151
|
152152
*/
153-
'clockwork' => false,
153+
'clockwork' => env('DEBUGBAR_CLOCKWORK', false),
154154

155155
/*
156156
|--------------------------------------------------------------------------
@@ -162,31 +162,31 @@
162162
*/
163163

164164
'collectors' => [
165-
'phpinfo' => false, // Php version
166-
'messages' => true, // Messages
167-
'time' => true, // Time Datalogger
168-
'memory' => true, // Memory usage
169-
'exceptions' => true, // Exception displayer
170-
'log' => true, // Logs from Monolog (merged in messages if enabled)
171-
'db' => true, // Show database (PDO) queries and bindings
172-
'views' => true, // Views with their data
173-
'route' => false, // Current route information
174-
'auth' => false, // Display Laravel authentication status
175-
'gate' => true, // Display Laravel Gate checks
176-
'session' => false, // Display session data
177-
'symfony_request' => true, // Only one can be enabled..
178-
'mail' => true, // Catch mail messages
179-
'laravel' => true, // Laravel version and environment
180-
'events' => false, // All events fired
181-
'default_request' => false, // Regular or special Symfony request logger
182-
'logs' => false, // Add the latest log messages
183-
'files' => false, // Show the included files
184-
'config' => false, // Display config settings
185-
'cache' => false, // Display cache events
186-
'models' => true, // Display models
187-
'livewire' => true, // Display Livewire (when available)
188-
'jobs' => false, // Display dispatched jobs
189-
'pennant' => false, // Display Pennant feature flags
165+
'phpinfo' => env('DEBUGBAR_COLLECTORS_PHPINFO', false), // Php version
166+
'messages' => env('DEBUGBAR_COLLECTORS_MESSAGES', true), // Messages
167+
'time' => env('DEBUGBAR_COLLECTORS_TIME', true), // Time Datalogger
168+
'memory' => env('DEBUGBAR_COLLECTORS_MEMORY', true), // Memory usage
169+
'exceptions' => env('DEBUGBAR_COLLECTORS_EXCEPTIONS', true), // Exception displayer
170+
'log' => env('DEBUGBAR_COLLECTORS_LOG', true), // Logs from Monolog (merged in messages if enabled)
171+
'db' => env('DEBUGBAR_COLLECTORS_DB', true), // Show database (PDO) queries and bindings
172+
'views' => env('DEBUGBAR_COLLECTORS_VIEWS', true), // Views with their data
173+
'route' => env('DEBUGBAR_COLLECTORS_ROUTE', false), // Current route information
174+
'auth' => env('DEBUGBAR_COLLECTORS_AUTH', false), // Display Laravel authentication status
175+
'gate' => env('DEBUGBAR_COLLECTORS_GATE', true), // Display Laravel Gate checks
176+
'session' => env('DEBUGBAR_COLLECTORS_SESSION', false), // Display session data
177+
'symfony_request' => env('DEBUGBAR_COLLECTORS_SYMFONY_REQUEST', true), // Only one can be enabled..
178+
'mail' => env('DEBUGBAR_COLLECTORS_MAIL', true), // Catch mail messages
179+
'laravel' => env('DEBUGBAR_COLLECTORS_LARAVEL', true), // Laravel version and environment
180+
'events' => env('DEBUGBAR_COLLECTORS_EVENTS', false), // All events fired
181+
'default_request' => env('DEBUGBAR_COLLECTORS_DEFAULT_REQUEST', false), // Regular or special Symfony request logger
182+
'logs' => env('DEBUGBAR_COLLECTORS_LOGS', false), // Add the latest log messages
183+
'files' => env('DEBUGBAR_COLLECTORS_FILES', false), // Show the included files
184+
'config' => env('DEBUGBAR_COLLECTORS_CONFIG', false), // Display config settings
185+
'cache' => env('DEBUGBAR_COLLECTORS_CACHE', false), // Display cache events
186+
'models' => env('DEBUGBAR_COLLECTORS_MODELS', true), // Display models
187+
'livewire' => env('DEBUGBAR_COLLECTORS_LIVEWIRE', true), // Display Livewire (when available)
188+
'jobs' => env('DEBUGBAR_COLLECTORS_JOBS', false), // Display dispatched jobs
189+
'pennant' => env('DEBUGBAR_COLLECTORS_PENNANT', false), // Display Pennant feature flags
190190
],
191191

192192
/*
@@ -200,70 +200,70 @@
200200

201201
'options' => [
202202
'time' => [
203-
'memory_usage' => false, // Calculated by subtracting memory start and end, it may be inaccurate
203+
'memory_usage' => env('DEBUGBAR_OPTIONS_TIME_MEMORY_USAGE', false), // Calculated by subtracting memory start and end, it may be inaccurate
204204
],
205205
'messages' => [
206-
'trace' => true, // Trace the origin of the debug message
207-
'capture_dumps' => false, // Capture laravel `dump();` as message
206+
'trace' => env('DEBUGBAR_OPTIONS_MESSAGES_TRACE', true), // Trace the origin of the debug message
207+
'capture_dumps' => env('DEBUGBAR_OPTIONS_MESSAGES_CAPTURE_DUMPS', false), // Capture laravel `dump();` as message
208208
],
209209
'memory' => [
210-
'reset_peak' => false, // run memory_reset_peak_usage before collecting
211-
'with_baseline' => false, // Set boot memory usage as memory peak baseline
212-
'precision' => 0, // Memory rounding precision
210+
'reset_peak' => env('DEBUGBAR_OPTIONS_MEMORY_RESET_PEAK', false), // run memory_reset_peak_usage before collecting
211+
'with_baseline' => env('DEBUGBAR_OPTIONS_MEMORY_WITH_BASELINE', false), // Set boot memory usage as memory peak baseline
212+
'precision' => (int) env('DEBUGBAR_OPTIONS_MEMORY_PRECISION', 0), // Memory rounding precision
213213
],
214214
'auth' => [
215-
'show_name' => true, // Also show the users name/email in the debugbar
216-
'show_guards' => true, // Show the guards that are used
215+
'show_name' => env('DEBUGBAR_OPTIONS_AUTH_SHOW_NAME', true), // Also show the users name/email in the debugbar
216+
'show_guards' => env('DEBUGBAR_OPTIONS_AUTH_SHOW_GUARDS', true), // Show the guards that are used
217217
],
218218
'db' => [
219-
'with_params' => true, // Render SQL with the parameters substituted
219+
'with_params' => env('DEBUGBAR_OPTIONS_WITH_PARAMS', true), // Render SQL with the parameters substituted
220220
'exclude_paths' => [ // Paths to exclude entirely from the collector
221221
// 'vendor/laravel/framework/src/Illuminate/Session', // Exclude sessions queries
222222
],
223-
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
223+
'backtrace' => env('DEBUGBAR_OPTIONS_DB_BACKTRACE', true), // Use a backtrace to find the origin of the query in your files.
224224
'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults)
225-
'timeline' => false, // Add the queries to the timeline
226-
'duration_background' => true, // Show shaded background on each query relative to how long it took to execute.
225+
'timeline' => env('DEBUGBAR_OPTIONS_DB_TIMELINE', false), // Add the queries to the timeline
226+
'duration_background' => env('DEBUGBAR_OPTIONS_DB_DURATION_BACKGROUND', true), // Show shaded background on each query relative to how long it took to execute.
227227
'explain' => [ // Show EXPLAIN output on queries
228-
'enabled' => false,
228+
'enabled' => env('DEBUGBAR_OPTIONS_DB_EXPLAIN_ENABLED', false),
229229
],
230-
'hints' => false, // Show hints for common mistakes
231-
'show_copy' => true, // Show copy button next to the query,
232-
'slow_threshold' => false, // Only track queries that last longer than this time in ms
233-
'memory_usage' => false, // Show queries memory usage
234-
'soft_limit' => 100, // After the soft limit, no parameters/backtrace are captured
235-
'hard_limit' => 500, // After the hard limit, queries are ignored
230+
'hints' => env('DEBUGBAR_OPTIONS_DB_HINTS', false), // Show hints for common mistakes
231+
'show_copy' => env('DEBUGBAR_OPTIONS_DB_SHOW_COPY', true), // Show copy button next to the query,
232+
'slow_threshold' => env('DEBUGBAR_OPTIONS_DB_SLOW_THRESHOLD', false), // Only track queries that last longer than this time in ms
233+
'memory_usage' => env('DEBUGBAR_OPTIONS_DB_MEMORY_USAGE', false), // Show queries memory usage
234+
'soft_limit' => (int) env('DEBUGBAR_OPTIONS_DB_SOFT_LIMIT', 100), // After the soft limit, no parameters/backtrace are captured
235+
'hard_limit' => (int) env('DEBUGBAR_OPTIONS_DB_HARD_LIMIT', 500), // After the hard limit, queries are ignored
236236
],
237237
'mail' => [
238-
'timeline' => true, // Add mails to the timeline
239-
'show_body' => true,
238+
'timeline' => env('DEBUGBAR_OPTIONS_MAIL_TIMELINE', true), // Add mails to the timeline
239+
'show_body' => env('DEBUGBAR_OPTIONS_MAIL_SHOW_BODY', true),
240240
],
241241
'views' => [
242-
'timeline' => true, // Add the views to the timeline
243-
'data' => false, // True for all data, 'keys' for only names, false for no parameters.
244-
'group' => 50, // Group duplicate views. Pass value to auto-group, or true/false to force
242+
'timeline' => env('DEBUGBAR_OPTIONS_VIEWS_TIMELINE', true), // Add the views to the timeline
243+
'data' => env('DEBUGBAR_OPTIONS_VIEWS_DATA', false), // True for all data, 'keys' for only names, false for no parameters.
244+
'group' => (int) env('DEBUGBAR_OPTIONS_VIEWS_GROUP', 50), // Group duplicate views. Pass value to auto-group, or true/false to force
245245
'exclude_paths' => [ // Add the paths which you don't want to appear in the views
246246
'vendor/filament' // Exclude Filament components by default
247247
],
248248
],
249249
'route' => [
250-
'label' => true, // Show complete route on bar
250+
'label' => env('DEBUGBAR_OPTIONS_ROUTE_LABEL', true), // Show complete route on bar
251251
],
252252
'session' => [
253253
'hiddens' => [], // Hides sensitive values using array paths
254254
],
255255
'symfony_request' => [
256-
'label' => true, // Show route on bar
256+
'label' => env('DEBUGBAR_OPTIONS_SYMFONY_REQUEST_LABEL', true), // Show route on bar
257257
'hiddens' => [], // Hides sensitive values using array paths, example: request_request.password
258258
],
259259
'events' => [
260-
'data' => false, // Collect events data, listeners
260+
'data' => env('DEBUGBAR_OPTIONS_EVENTS_DATA', false), // Collect events data, listeners
261261
],
262262
'logs' => [
263-
'file' => null,
263+
'file' => env('DEBUGBAR_OPTIONS_LOGS_FILE', null),
264264
],
265265
'cache' => [
266-
'values' => true, // Collect cache values
266+
'values' => env('DEBUGBAR_OPTIONS_CACHE_VALUES', true), // Collect cache values
267267
],
268268
],
269269

@@ -278,7 +278,7 @@
278278
|
279279
*/
280280

281-
'inject' => true,
281+
'inject' => env('DEBUGBAR_INJECT', true),
282282

283283
/*
284284
|--------------------------------------------------------------------------
@@ -290,7 +290,7 @@
290290
| from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97
291291
|
292292
*/
293-
'route_prefix' => '_debugbar',
293+
'route_prefix' => env('DEBUGBAR_ROUTE_PREFIX', '_debugbar'),
294294

295295
/*
296296
|--------------------------------------------------------------------------
@@ -309,7 +309,7 @@
309309
| By default Debugbar route served from the same domain that request served.
310310
| To override default domain, specify it as a non-empty value.
311311
*/
312-
'route_domain' => null,
312+
'route_domain' => env('DEBUGBAR_ROUTE_DOMAIN', null),
313313

314314
/*
315315
|--------------------------------------------------------------------------
@@ -329,5 +329,5 @@
329329
| By default, the Debugbar limits the number of frames returned by the 'debug_backtrace()' function.
330330
| If you need larger stacktraces, you can increase this number. Setting it to 0 will result in no limit.
331331
*/
332-
'debug_backtrace_limit' => 50,
332+
'debug_backtrace_limit' => (int) env('DEBUGBAR_DEBUG_BACKTRACE_LIMIT', 50),
333333
];

0 commit comments

Comments
 (0)