diff options
| author | moderndevslulw <moderndevslulw@alright.party> | 2025-07-08 14:05:55 +0500 |
|---|---|---|
| committer | moderndevslulw <moderndevslulw@alright.party> | 2025-07-08 14:05:55 +0500 |
| commit | 28863f40a7f9ffc8e59e0c3587cbc5938a683342 (patch) | |
| tree | 63f794a3c4fd77f0bf36bdb429fde291819e9715 | |
| parent | 23383a8a635e6a71fe0c972d942f40ad1af7f776 (diff) | |
feat: config.php
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | config.php | 31 |
2 files changed, 31 insertions, 1 deletions
@@ -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 |
