Update AppController.php

Modify the doSetup() to use a similar way to create the .env file and add quotes when needed.
This commit is contained in:
vincentdh 2016-03-26 12:52:21 -04:00
parent 965ef011e5
commit 690ebf853f

View File

@ -83,28 +83,28 @@ class AppController extends BaseController
return Redirect::to('/'); return Redirect::to('/');
} }
$_ENV['APP_ENV']='production'; $_ENV['APP_ENV']='production';
$_ENV['APP_DEBUG']=$app['debug']; $_ENV['APP_DEBUG']=$app['debug'];
$_ENV['APP_URL']=$app['url']; $_ENV['APP_URL']=$app['url'];
$_ENV['APP_KEY']=$app['key']; $_ENV['APP_KEY']=$app['key'];
$_ENV['DB_TYPE']=$dbType; $_ENV['DB_TYPE']=$dbType;
$_ENV['DB_HOST']=$database['type']['host']; $_ENV['DB_HOST']=$database['type']['host'];
$_ENV['DB_DATABASE']=$database['type']['database']; $_ENV['DB_DATABASE']=$database['type']['database'];
$_ENV['DB_USERNAME']=$database['type']['username']; $_ENV['DB_USERNAME']=$database['type']['username'];
$_ENV['DB_PASSWORD']=$database['type']['password']; $_ENV['DB_PASSWORD']=$database['type']['password'];
$_ENV['MAIL_DRIVER']=$mail['driver']; $_ENV['MAIL_DRIVER']=$mail['driver'];
$_ENV['MAIL_PORT']=$mail['port']; $_ENV['MAIL_PORT']=$mail['port'];
$_ENV['MAIL_ENCRYPTION']=$mail['encryption']; $_ENV['MAIL_ENCRYPTION']=$mail['encryption'];
$_ENV['MAIL_HOST']=$mail['host']; $_ENV['MAIL_HOST']=$mail['host'];
$_ENV['MAIL_USERNAME']=$mail['username'];; $_ENV['MAIL_USERNAME']=$mail['username'];;
$config = ''; $config = '';
foreach ($_ENV as $key => $val) { foreach ($_ENV as $key => $val) {
if (preg_match('/\s/',$val)) { if (preg_match('/\s/',$val)) {
$val = "'{$val}'"; $val = "'{$val}'";
} }
$config .= "{$key}={$val}\n"; $config .= "{$key}={$val}\n";
} }
// Write Config Settings // Write Config Settings