Skip to content

Commit 30fffea

Browse files
cbaconnierrap2hpoutre
authored andcommitted
Add MAX_FILE_SIZE to config (#201)
* Add MAX_FILE_SIZE to config * Fix typo
1 parent ba8e645 commit 30fffea

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ public function all()
150150
$this->file = $log_file[0];
151151
}
152152

153-
if (app('files')->size($this->file) > self::MAX_FILE_SIZE) {
153+
$max_file_size = function_exists('config') ? config('logviewer.max_file_size', self::MAX_FILE_SIZE) : self::MAX_FILE_SIZE;
154+
if (app('files')->size($this->file) > $max_file_size) {
154155
return null;
155156
}
156157

src/config/logviewer.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<?php
22

33
return [
4-
/*
5-
|--------------------------------------------------------------------------
6-
| Pattern and storage path settings
7-
|--------------------------------------------------------------------------
8-
|
9-
| The env key for pattern and storage path with a default value
10-
|
11-
*/
12-
'pattern' => env('LOGVIEWER_PATTERN', '*.log'),
13-
'storage_path' => env('LOGVIEWER_STORAGE_PATH', storage_path('logs')),
4+
/*
5+
|--------------------------------------------------------------------------
6+
| Pattern and storage path settings
7+
|--------------------------------------------------------------------------
8+
|
9+
| The env key for pattern and storage path with a default value
10+
|
11+
*/
12+
'max_file_size' => 52428800, // size in Byte
13+
'pattern' => env('LOGVIEWER_PATTERN', '*.log'),
14+
'storage_path' => env('LOGVIEWER_STORAGE_PATH', storage_path('logs')),
1415
];

0 commit comments

Comments
 (0)