Skip to content

Commit

Permalink
Add config file to avoid config cache propblem Fixes #1
Browse files Browse the repository at this point in the history
muruganstr committed Jan 25, 2018
1 parent 4df1f1f commit 4c8564e
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions config/tinify.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'apikey' => env('TINIFY_APIKEY'),
];
6 changes: 4 additions & 2 deletions src/LaravelTinifyServiceProvider.php
Original file line number Diff line number Diff line change
@@ -20,7 +20,8 @@ class LaravelTinifyServiceProvider extends ServiceProvider {
*/
public function boot()
{

$configPath = __DIR__ . '/../config/tinify.php';
$this->publishes([$configPath => config_path('tinify.php')], 'config');
}

/**
@@ -30,7 +31,8 @@ public function boot()
*/
public function register()
{

$configPath = __DIR__ . '/../config/tinify.php';
$this->mergeConfigFrom($configPath, 'tinify');
$this->app->bind('tinify', 'yasmuru\LaravelTinify\Services\TinifyService');

}
2 changes: 1 addition & 1 deletion src/Services/TinifyService.php
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ class TinifyService {
* @throws Exception
*/
public function __construct() {
$this->apikey = env('TINIFY_APIKEY');
$this->apikey = config('tinify.apikey');
if(!$this->apikey) {
throw new \InvalidArgumentException('Please set TINIFY_APIKEY environment variables.');
}

0 comments on commit 4c8564e

Please sign in to comment.