hardcoded port and hostname matching name of docker setup

This commit is contained in:
luptmoor
2026-04-19 12:26:03 +02:00
parent c249c8e049
commit 250ca9909d
2 changed files with 10 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
# Example Environment Configfile # Example Environment Configfile
POSTGRES_HOST=postgres_host POSTGRES_HOSTNAME=postgres_host
POSTGRES_PORT=postgres_port POSTGRES_PORT=postgres_port
POSTGRES_DB=postgres_database POSTGRES_DB=postgres_database
POSTGRES_USER=postgres_user POSTGRES_USER=postgres_user

View File

@@ -16,8 +16,8 @@ if (file_exists($envFile)) {
} }
// Defines Environment Variables // Defines Environment Variables
$host = getenv('POSTGRES_HOST'); $host = getenv('POSTGRES_HOSTNAME');
$port = getenv('POSTGRES_PORT'); $port = 5432;
$db = getenv('POSTGRES_DB'); $db = getenv('POSTGRES_DB');
$user = getenv('POSTGRES_USER'); $user = getenv('POSTGRES_USER');
$pass = getenv('POSTGRES_PASSWORD'); $pass = getenv('POSTGRES_PASSWORD');
@@ -35,6 +35,13 @@ try {
]; ];
$dsn = "pgsql:host=$host;dbname=$db;port=$port"; $dsn = "pgsql:host=$host;dbname=$db;port=$port";
$pdo = new PDO($dsn, $user, $pass, $opt); $pdo = new PDO($dsn, $user, $pass, $opt);
$pdo = new PDO($dsn, $user, $pass, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
// Creates Error Message // Creates Error Message
} catch(PDOException $e) { } catch(PDOException $e) {