Update config/database.php
This commit is contained in:
+8
-8
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
// Sesuaikan konfigurasi database sesuai lingkungan server yang digunakan.
|
||||
$DB_HOST = 'localhost';
|
||||
$DB_NAME = 'sipantas_webgis';
|
||||
$DB_USER = 'root';
|
||||
$DB_PASS = '';
|
||||
$DB_HOST = getenv('DB_HOST') ?: 'localhost';
|
||||
$DB_NAME = getenv('DB_NAME') ?: 'sipantas_webgis';
|
||||
$DB_USER = getenv('DB_USER') ?: 'root';
|
||||
$DB_PASS = getenv('DB_PASS') ?: '';
|
||||
$DB_PORT = getenv('DB_PORT') ?: '3306';
|
||||
$DB_CHARSET = 'utf8mb4';
|
||||
|
||||
try {
|
||||
$pdo = new PDO(
|
||||
"mysql:host={$DB_HOST};dbname={$DB_NAME};charset={$DB_CHARSET}",
|
||||
"mysql:host={$DB_HOST};port={$DB_PORT};dbname={$DB_NAME};charset={$DB_CHARSET}",
|
||||
$DB_USER,
|
||||
$DB_PASS,
|
||||
[
|
||||
@@ -19,5 +19,5 @@ try {
|
||||
);
|
||||
} catch (PDOException $e) {
|
||||
http_response_code(500);
|
||||
die('Koneksi database gagal. Pastikan database sipantas_webgis sudah di-import. Detail: ' . htmlspecialchars($e->getMessage()));
|
||||
}
|
||||
die('Koneksi database gagal: ' . htmlspecialchars($e->getMessage()));
|
||||
}
|
||||
Reference in New Issue
Block a user