Merge fix #787 for spaces in .env file

This commit is contained in:
Hillel Coren 2016-03-31 17:14:34 +03:00
parent 90baeb5018
commit 6a6c932bf6

View File

@ -83,23 +83,29 @@ class AppController extends BaseController
return Redirect::to('/'); return Redirect::to('/');
} }
$config = "APP_ENV=production\n". $_ENV['APP_ENV']='production';
"APP_DEBUG={$app['debug']}\n". $_ENV['APP_DEBUG']=$app['debug'];
"APP_URL={$app['url']}\n". $_ENV['APP_URL']=$app['url'];
"APP_KEY={$app['key']}\n\n". $_ENV['APP_KEY']=$app['key'];
"DB_TYPE={$dbType}\n". $_ENV['DB_TYPE']=$dbType;
"DB_HOST={$database['type']['host']}\n". $_ENV['DB_HOST']=$database['type']['host'];
"DB_DATABASE={$database['type']['database']}\n". $_ENV['DB_DATABASE']=$database['type']['database'];
"DB_USERNAME={$database['type']['username']}\n". $_ENV['DB_USERNAME']=$database['type']['username'];
"DB_PASSWORD={$database['type']['password']}\n\n". $_ENV['DB_PASSWORD']=$database['type']['password'];
"MAIL_DRIVER={$mail['driver']}\n". $_ENV['MAIL_DRIVER']=$mail['driver'];
"MAIL_PORT={$mail['port']}\n". $_ENV['MAIL_PORT']=$mail['port'];
"MAIL_ENCRYPTION={$mail['encryption']}\n". $_ENV['MAIL_ENCRYPTION']=$mail['encryption'];
"MAIL_HOST={$mail['host']}\n". $_ENV['MAIL_HOST']=$mail['host'];
"MAIL_USERNAME={$mail['username']}\n". $_ENV['MAIL_USERNAME']=$mail['username'];;
"MAIL_FROM_NAME={$mail['from']['name']}\n".
"MAIL_PASSWORD={$mail['password']}\n\n". $config = '';
"PHANTOMJS_CLOUD_KEY='a-demo-key-with-low-quota-per-ip-address'"; foreach ($_ENV as $key => $val) {
if (preg_match('/\s/',$val)) {
$val = "'{$val}'";
}
$config .= "{$key}={$val}\n";
}
// Write Config Settings // Write Config Settings
$fp = fopen(base_path()."/.env", 'w'); $fp = fopen(base_path()."/.env", 'w');
@ -166,6 +172,9 @@ class AppController extends BaseController
$config = ''; $config = '';
foreach ($_ENV as $key => $val) { foreach ($_ENV as $key => $val) {
if (preg_match('/\s/',$val)) {
$val = "'{$val}'";
}
$config .= "{$key}={$val}\n"; $config .= "{$key}={$val}\n";
} }