Skip to content

Commit

Permalink
Add MAX_FILE_SIZE to config (#201)
Browse files Browse the repository at this point in the history
* Add MAX_FILE_SIZE to config

* Fix typo
  • Loading branch information
cbaconnier authored and rap2hpoutre committed Aug 19, 2019
1 parent ba8e645 commit 30fffea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ public function all()
$this->file = $log_file[0];
}

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

Expand Down
21 changes: 11 additions & 10 deletions src/config/logviewer.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php

return [
/*
|--------------------------------------------------------------------------
| Pattern and storage path settings
|--------------------------------------------------------------------------
|
| The env key for pattern and storage path with a default value
|
*/
'pattern' => env('LOGVIEWER_PATTERN', '*.log'),
'storage_path' => env('LOGVIEWER_STORAGE_PATH', storage_path('logs')),
/*
|--------------------------------------------------------------------------
| Pattern and storage path settings
|--------------------------------------------------------------------------
|
| The env key for pattern and storage path with a default value
|
*/
'max_file_size' => 52428800, // size in Byte
'pattern' => env('LOGVIEWER_PATTERN', '*.log'),
'storage_path' => env('LOGVIEWER_STORAGE_PATH', storage_path('logs')),
];

0 comments on commit 30fffea

Please sign in to comment.