-
Notifications
You must be signed in to change notification settings - Fork 170
Expand file tree
/
Copy pathconfig.php
More file actions
108 lines (85 loc) · 2.56 KB
/
config.php
File metadata and controls
108 lines (85 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
// mLITE - Kompatibel dengan PHP 7.4 - 8.3+
if (!version_compare(PHP_VERSION, '8.0.0', '>=')) {
exit("mLITE requires at least <b>PHP 8.0.0</b> (Current: " . PHP_VERSION . ")");
}
function env(string $key, $default = null) {
return $_ENV[$key] ?? $_SERVER[$key] ?? $default;
}
// Simple .env loader (PHP 8.3 safe, no putenv)
if (file_exists(BASE_DIR . '/.env')) {
$lines = file(BASE_DIR . '/.env', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($lines as $line) {
$line = trim($line);
// Skip komentar & baris kosong
if ($line === '' || str_starts_with($line, '#')) {
continue;
}
if (!str_contains($line, '=')) {
continue;
}
[$name, $value] = explode('=', $line, 2);
$name = trim($name);
$value = trim($value);
// Hapus tanda kutip jika ada
$value = trim($value, "\"'");
if (!isset($_ENV[$name]) && !isset($_SERVER[$name])) {
$_ENV[$name] = $value;
$_SERVER[$name] = $value;
}
}
}
// Database Driver: 'mysql' or 'sqlite'
define('DBDRIVER', env('DBDRIVER') ?: '');
if (DBDRIVER == 'sqlite') {
$db_host = '';
$db_user = '';
$db_pass = '';
$db_name = BASE_DIR . '/systems/data/mlite.sdb';
$db_port = '';
} else {
$db_host = env('MYSQLHOST') ?: 'localhost';
$db_user = env('MYSQLUSER') ?: 'root';
$db_pass = env('MYSQLPASSWORD') ?: '';
$db_name = env('MYSQLDATABASE') ?: 'mlite';
$db_port = env('MYSQLPORT') ?: '3306';
}
define('DBHOST', $db_host);
define('DBPORT', $db_port);
define('DBUSER', $db_user);
define('DBPASS', $db_pass);
define('DBNAME', $db_name);
// URL Webapps
define('WEBAPPS_URL', 'http://localhost:8000/uploads'); // Sesuaikan http://mlite.loc dengan domain atau IP Address server
define('WEBAPPS_PATH', BASE_DIR . '/uploads');
// Multi APP
define('MULTI_APP', false);
define('MULTI_APP_REDIRECT', '');
// Admin cat name
define('ADMIN', 'admin');
// Themes path
define('THEMES', BASE_DIR . '/themes');
// Modules path
define('MODULES', BASE_DIR . '/plugins');
// Uploads path
define('UPLOADS', BASE_DIR . '/uploads');
// Lock files
define('FILE_LOCK', false);
// Basic modules
define('BASIC_MODULES', serialize([
9 => 'settings',
0 => 'dashboard',
1 => 'master',
2 => 'pasien',
3 => 'rawat_jalan',
4 => 'kasir_rawat_jalan',
5 => 'kepegawaian',
6 => 'farmasi',
8 => 'users',
7 => 'modules',
10 => 'wagateway'
]));
// Developer mode
define('DEV_MODE', true);
define('JWT_SECRET', 'mlite_secret_key_change_me');
?>