summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoderndevslulw <moderndevslulw@alright.party>2025-07-08 14:05:55 +0500
committermoderndevslulw <moderndevslulw@alright.party>2025-07-08 14:05:55 +0500
commit28863f40a7f9ffc8e59e0c3587cbc5938a683342 (patch)
tree63f794a3c4fd77f0bf36bdb429fde291819e9715
parent23383a8a635e6a71fe0c972d942f40ad1af7f776 (diff)
feat: config.php
-rw-r--r--.gitignore1
-rw-r--r--config.php31
2 files changed, 31 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 2476444..95033ff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-config.php
/vendor/
scriptmetadata.json
*.ini \ No newline at end of file
diff --git a/config.php b/config.php
new file mode 100644
index 0000000..a214ac9
--- /dev/null
+++ b/config.php
@@ -0,0 +1,31 @@
+<?php
+
+// Filepath to your configuration file
+$config_file_path = $_SERVER['DOCUMENT_ROOT'] . '/../config.ini';
+define('BOT_CONFIG', parse_ini_file($config_file_path, true));
+
+// WIKI
+define('WIKI_PAGE_DIRECTORY', BOT_CONFIG['web']['wiki_page_directory']);
+define('SHOW_CHANNEL_LIST', boolval(['web']['show_channel_list'] ?? "true"));
+
+// COMMANDS
+define('LUA_SCRIPT_DIRECTORY', BOT_CONFIG['web']['lua_script_directory']);
+
+// DATABASE
+$db_prefix = "mysql";
+if (str_starts_with(BOT_CONFIG['database']['driver'], 'postgres')) {
+ $db_prefix = "pgsql";
+}
+define('DB_URL', "$db_prefix:host=" . BOT_CONFIG['database']['host'] . ';port=' . BOT_CONFIG['database']['port'] . ';dbname=' . BOT_CONFIG['database']['name']);
+define('DB_USER', BOT_CONFIG['database']['user']);
+define('DB_PASS', BOT_CONFIG['database']['pass']);
+
+// TWITCH CREDENTIALS
+define('BOT_USERNAME', BOT_CONFIG['twitch']['username']);
+define('BOT_USERNAME_FORMATTED', '@' . BOT_USERNAME);
+define('TWITCH_AUTHORIZATION_TOKEN', BOT_CONFIG['twitch']['password']);
+define('TWITCH_CLIENT_ID', BOT_CONFIG['twitch']['client_id']);
+
+// CONTACT
+define('CONTACT_NAME', BOT_CONFIG['web']['contact_name'] ?? null);
+define('CONTACT_URL', BOT_CONFIG['web']['contact_url'] ?? null); \ No newline at end of file