diff --git a/.drone.yml b/.drone.yml index e3b533b..b74816d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -68,3 +68,4 @@ steps: ADMINS: dorianhodin,alexislamande,baptistebaverel,johanlachenal depends_on: [ deploy_api_form ] + diff --git a/Source/API/script/Config/ConnectClass.php b/Source/API/script/Config/ConnectClass.php index 8d0bb99..2191450 100644 --- a/Source/API/script/Config/ConnectClass.php +++ b/Source/API/script/Config/ConnectClass.php @@ -2,6 +2,7 @@ namespace Config; +use ExceptionHandle\PDOError; use PDOException; require_once __DIR__ ."/Connection.php"; @@ -13,6 +14,9 @@ class ConnectClass{ private string $password; function __construct(){ + if ($_ENV["HOST"] == null || $_ENV["DATABASE"] == null || $_ENV["USER"] == null || $_ENV["PASSWORD"] == null){ + throw new PDOException("ENV variable not found"); + } $this->dsn = "mysql:host=".$_ENV["HOST"].";dbname=".$_ENV["DATABASE"].";charset=UTF8"; $this->login = $_ENV["USER"]; $this->password = $_ENV["PASSWORD"];