From f4150ef12cac7842c6135b7d32b7bb63609fa2f8 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Mon, 29 May 2023 15:26:41 +0700 Subject: [PATCH] Added exception if .env not found (#734) --- common.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/common.php b/common.php index 744b9828f..47742eb42 100644 --- a/common.php +++ b/common.php @@ -63,9 +63,15 @@ function env(string $key, $default = null) return \TorrentPier\Env::get($key, $default); } -// Get initial config -$dotenv = Dotenv\Dotenv::createMutable(BB_PATH); -$dotenv->safeLoad(); +// Load ENV +try { + $dotenv = Dotenv\Dotenv::createMutable(BB_PATH); + $dotenv->load(); +} catch (\Dotenv\Exception\InvalidPathException $pathException) { + die('Please rename from .env.example to .env, and configure it'); +} + +// Load config require_once BB_PATH . '/library/config.php'; // Local config