Skip to content

Commit

Permalink
Add better error message for missing app key
Browse files Browse the repository at this point in the history
  • Loading branch information
thecrypticace committed May 11, 2017
1 parent ff3d504 commit 3a4fdd0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Illuminate/Encryption/EncryptionServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Encryption;

use RuntimeException;
use Illuminate\Support\Str;
use Illuminate\Support\ServiceProvider;

Expand All @@ -24,6 +25,12 @@ public function register()
$key = base64_decode(substr($key, 7));
}

if (is_null($key) || $key === '') {
throw new RuntimeException(
'The application encryption key is missing. Run php artisan key:generate to generate it.'
);
}

return new Encrypter($key, $config['cipher']);
});
}
Expand Down

0 comments on commit 3a4fdd0

Please sign in to comment.