17 lines
545 B
PHP

<?php
// Database configuration (Docker Compose friendly).
// NOTE: In Docker, the DB host is the service name (e.g., "db"), not "localhost".
$DB_HOST = getenv('DB_HOST') ?: 'db';
$DB_USER = getenv('DB_USER') ?: 'passman_app';
$DB_PASS = getenv('DB_PASS') ?: 'passman_app_pw';
$DB_NAME = getenv('DB_NAME') ?: 'pwd_mgr';
// Create a DB connection.
$conn = mysqli_connect($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
if (!$conn) {
// Fail fast if the DB is not reachable.
die("Database connection failed: " . mysqli_connect_error());
}
//?>