Skip to content

Commit

Permalink
Merge pull request #12 from vrkansagara/dev
Browse files Browse the repository at this point in the history
Fixing debug issue and environment issue.
  • Loading branch information
vrkansagara authored May 25, 2018
2 parents c579475 + ac06718 commit 14248cf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@ protected $middleware = [

Add your target environment into `.env`
~~~bash
VRKANSAGARA_COMPRESS_ENVIRONMENT='prod,testing,dev'
VRKANSAGARA_COMPRESS_ENVIRONMENT='prod,testing,dev,local'
~~~


If you want to see how much you compress on each page, set bellow line in `.env`
~~~bash
VRKANSAGARA_COMPRESS_DEBUG=0
~~~


### Display usage on each page.

Set `$debug = 1;` in `AfterMiddleware.php`
Expand Down
9 changes: 8 additions & 1 deletion src/Http/Middleware/AfterMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AfterMiddleware

public $bufferOldSize;
public $bufferNewSize;
public $debug = 1;
public $debug = 0;

/**
* Handle an incoming request.
Expand All @@ -25,6 +25,13 @@ class AfterMiddleware
*/
public function handle($request, Closure $next)
{

$isDebug = null !== getenv('VRKANSAGARA_COMPRESS_DEBUG')
? getenv('VRKANSAGARA_COMPRESS_DEBUG')
: 0;
if ($isDebug) {
$this->debug = 1;
}
$targetEnvironment = explode(
',', getenv('VRKANSAGARA_COMPRESS_ENVIRONMENT')
);
Expand Down

0 comments on commit 14248cf

Please sign in to comment.