summaryrefslogtreecommitdiff
path: root/lib/config.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/config.php')
-rw-r--r--lib/config.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/config.php b/lib/config.php
new file mode 100644
index 0000000..8705999
--- /dev/null
+++ b/lib/config.php
@@ -0,0 +1,13 @@
+<?php
+
+$file_path = $_SERVER['DOCUMENT_ROOT'] . '/config.ini';
+
+$c = parse_ini_file($file_path, true) ?: [];
+
+define('DB_URL', "{$c['database']['driver']}:dbname={$c['database']['name']};host={$c['database']['host']}");
+define('DB_USER', $c['database']['user'] ?? null);
+define('DB_PASS', $c['database']['pass'] ?? null);
+
+define('SOUND_DIRECTORY', $c['sound']['directory'] ?? "{$_SERVER['DOCUMENT_ROOT']}/static/userdata/sounds");
+
+define('IS_JSON_REQUEST', isset($_SERVER['HTTP_ACCEPT']) && str_contains($_SERVER['HTTP_ACCEPT'], 'application/json')); \ No newline at end of file