From 0175872d87a960cb8245defb1af4eaa4e41b5a4f Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Sun, 21 Jun 2020 20:53:36 -0500 Subject: [PATCH] run artisan key:generate externally --- LibreNMS/Util/EnvHelper.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/LibreNMS/Util/EnvHelper.php b/LibreNMS/Util/EnvHelper.php index 943acaecee..c09443fe5e 100644 --- a/LibreNMS/Util/EnvHelper.php +++ b/LibreNMS/Util/EnvHelper.php @@ -25,7 +25,6 @@ namespace LibreNMS\Util; -use Artisan; use ErrorException; use LibreNMS\Exceptions\FileWriteFailedException; @@ -114,11 +113,11 @@ class EnvHelper $env_file = base_path('.env'); try { if (!file_exists($env_file)) { - Artisan::call('key:generate', ['--show' => true]); - $key = trim(Artisan::output()); + copy(base_path('.env.example'), $env_file); + + $key = trim(exec(PHP_BINDIR . '/php ' . base_path('artisan') . ' key:generate --show')); config(['app.key' => $key]); - copy(base_path('.env.example'), $env_file); self::writeEnv([ 'APP_KEY' => $key, 'INSTALL' => !file_exists(base_path('config.php')) ? 'true' : false, // if both .env and config.php are missing, assume install is needed