user and pw as env vars

This commit is contained in:
luptmoor
2026-04-15 14:26:27 +02:00
parent a8ab95ff3a
commit 7bcb31a8f8

View File

@@ -1,4 +1,10 @@
<?php <?php
$host = 'webgis-db'; // Matches the service name in docker-compose
$db = getenv('POSTGRES_DB');
$user = getenv('POSTGRES_USER');
$pass = getenv('POSTGRES_PASSWORD');
ob_start(); ob_start();
session_start(); session_start();
@@ -10,8 +16,8 @@
PDO::ATTR_EMULATE_PREPARES => false PDO::ATTR_EMULATE_PREPARES => false
]; ];
$dsn = "pgsql:host=localhost;dbname=WebGIS;port=5432"; $dsn = "pgsql:host=localhost;dbname=$db;port=5432";
$pdo = new PDO($dsn, 'postgres', '1a2b3c4d5e6f', $opt); $pdo = new PDO($dsn, $user, $pass, $opt);
// Error-Message // Error-Message
} catch(PDOException $e) { } catch(PDOException $e) {