From d541bbb9ad3b6e1eda06050cc701858655e6aec6 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Sat, 28 Feb 2026 20:48:27 +0530 Subject: [PATCH] Allow one-time setup access via .env key for server use --- app/Controllers/Setup.php | 9 +++++++++ app/Views/setup/db_setup.php | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/app/Controllers/Setup.php b/app/Controllers/Setup.php index e37a1c2..4c5c3a8 100644 --- a/app/Controllers/Setup.php +++ b/app/Controllers/Setup.php @@ -22,6 +22,14 @@ class Setup extends BaseController return $this->response->setStatusCode(404)->setBody('Setup is already completed and locked.'); } + $keyFromEnv = trim((string) env('setup.dbToolsKey', '')); + if ($keyFromEnv !== '') { + $keyFromRequest = trim((string) ($this->request->getGet('key') ?? $this->request->getPost('key') ?? '')); + if ($keyFromRequest !== '' && hash_equals($keyFromEnv, $keyFromRequest)) { + return null; + } + } + if (!function_exists('auth')) { return null; } @@ -77,6 +85,7 @@ class Setup extends BaseController 'tables' => $tableRows, 'msg' => $flash, 'lock_file' => $this->lockFilePath(), + 'setup_key' => trim((string) env('setup.dbToolsKey', '')), ]); } diff --git a/app/Views/setup/db_setup.php b/app/Views/setup/db_setup.php index 5f162a4..3aac895 100644 --- a/app/Views/setup/db_setup.php +++ b/app/Views/setup/db_setup.php @@ -19,6 +19,9 @@
+ + +
@@ -64,6 +67,9 @@ + + +

Lock file: