Dockerize passman for modern environments
Ported the original passman PHP/MySQL application to a Docker-based setup using Apache and MariaDB. Fixed compatibility issues with modern PHP/MariaDB versions (HTTP header handling and database collation) using minimal, targeted changes. Preserved the original application logic and structure while ensuring correct execution in a contemporary containerized environment.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<?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') ?: 'root';
|
||||
$DB_PASS = getenv('DB_PASS') ?: 'rootpass';
|
||||
$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());
|
||||
}
|
||||
//?>
|
||||
Reference in New Issue
Block a user