1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Merge pull request #787 from vincentdh/patch-2

Update AppController.php to add single quotes in the .env file when needed
This commit is contained in:
Hillel Coren 2016-03-27 17:36:03 +03:00
commit e902ad546e

View File

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