Add check to see that we're installed, and remove the .env that's created

This commit is contained in:
Nabeel Shahzad 2017-12-16 12:01:21 -06:00
parent 2dd259802d
commit 5bc8dab6f8
6 changed files with 27 additions and 16 deletions

View File

@ -1,14 +0,0 @@
APP_ENV=dev
APP_KEY=base64:ve66Z5Kt/zTN3p++0zOPu854PHfZkwJE5VuoFAlzHtI=
APP_DEBUG=true
APP_LOCALE=en
APP_URL=http://localhost
APP_LOG=daily
APP_LOG_LEVEL=debug
APP_LOG_MAX_FILES=7
DB_CONNECTION=sqlite
CACHE_DRIVER=array
CACHE_PREFIX=

View File

@ -30,6 +30,7 @@
<inspection_tool class="PhpExpressionResultUnusedInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpIncludeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpSignatureMismatchDuringInheritanceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpUnnecessaryFullyQualifiedNameInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="SecurityAdvisoriesInspection" enabled="false" level="WARNING" enabled_by_default="false">
<option name="optionConfiguration">
<list>

View File

@ -19,7 +19,6 @@ if [ "$TRAVIS" = "true" ]; then
rm -rf .idea phpvms.iml .travis .dpl
rm -rf .phpstorm.meta.php _ide_helper.php
php artisan version:show --format compact --suppress-app-name > VERSION
mv .env.dev.example .env
echo "creating tarball"
cd /tmp

View File

@ -25,6 +25,7 @@ class Kernel extends HttpKernel
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\InstalledCheck::class,
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,

View File

@ -0,0 +1,24 @@
<?php
/**
* Handle the authentication for the API layer
*/
namespace App\Http\Middleware;
use Closure;
class InstalledCheck
{
/**
* Check the app.key to see whether we're installed or not
*
*/
public function handle($request, Closure $next)
{
if (config('app.key') === 'NOT_INSTALLED') {
return view('system.errors.not_installed');
}
return $next($request);
}
}

View File

@ -12,7 +12,7 @@ return [
'locale' => env('APP_LOCALE', 'en'),
'fallback_locale' => 'en',
'key' => env('APP_KEY'),
'key' => env('APP_KEY', 'NOT_INSTALLED'),
'cipher' => 'AES-256-CBC',
'log' => env('APP_LOG', 'daily'),