user and pw as env vars
This commit is contained in:
10
init.php
10
init.php
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user