Skip to content

Commit

Permalink
Update main.bootstrap.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Nenglish7 authored Jan 3, 2018
1 parent cabcf66 commit d8c3f38
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions main.bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@
{
$key = new Key();
$rsp_key = $key->generateKey();
$env['application']['APP_SECRET_KEY'] = $rsp_key;
$rsp_file = file_get_contents(APP_ROOT . '/.env.ini');
if ($env['application']['APP_SECRET_KEY'] == 'null')
if (isset($env['application']['APP_SECRET_KEY']) && $env['application']['APP_SECRET_KEY'] == 'null')
{
$rsp_file = str_replace('APP_SECRET_KEY=null', "APP_SECRET_KEY=$rsp_key", $rsp_file);
$rsp_file = str_replace('APP_SECRET_KEY=null', "APP_SECRET_KEY = $rsp_key", $rsp_file);
$rsp_file = str_replace('APP_SECRET_KEY= null', "APP_SECRET_KEY = $rsp_key", $rsp_file);
$rsp_file = str_replace('APP_SECRET_KEY =null', "APP_SECRET_KEY = $rsp_key", $rsp_file);
$rsp_file = str_replace('APP_SECRET_KEY = null', "APP_SECRET_KEY = $rsp_key", $rsp_file);
file_put_contents(APP_ROOT . '/.env.ini', $rsp_file, LOCK_EX);
goto doneRsp;
}
$rsp_file = str_replace('[application]', "[application] \n APP_SECRET_KEY=$rsp_key \n", $rsp_file);
$rsp_file = str_replace('[application]', "[application]\nAPP_SECRET_KEY = $rsp_key", $rsp_file);
file_put_contents(APP_ROOT . '/.env.ini', $rsp_file, LOCK_EX);
}
doneRsp:
Expand Down

0 comments on commit d8c3f38

Please sign in to comment.