#pragma once #include #include #include #include #define GET_DATABASE_CONNECTION_URL(c) \ "dbname = " + c.database.name + " user = " + c.database.user + \ " password = " + c.database.password + " host = " + c.database.host + \ " port = " + c.database.port #define GET_DATABASE_CONNECTION_URL_POINTER(c) \ "dbname = " + c->database.name + " user = " + c->database.user + \ " password = " + c->database.password + " host = " + c->database.host + \ " port = " + c->database.port namespace bot { struct DatabaseConfiguration { std::string name; std::string user; std::string password; std::string host; std::string port; }; struct TwitchConfiguration { std::string client_id; std::string token; std::vector trusted_user_ids; }; struct KickCredentialsConfiguration { std::string client_id, client_secret; }; struct CommandConfiguration { bool join_allowed = true; bool join_allow_from_other_chats = false; std::optional rpost_path = std::nullopt; std::optional paste_path = std::nullopt; std::string paste_body_name = "paste"; std::string paste_title_name = "title"; }; struct OwnerConfiguration { std::optional name = std::nullopt; std::optional id = std::nullopt; }; struct UrlConfiguration { std::optional help = std::nullopt; std::optional paste_service = std::nullopt; std::optional randompost = std::nullopt; }; struct TokenConfiguration { std::optional github_token = std::nullopt; }; struct RssConfiguration { std::optional bridge = std::nullopt; int timeout = 60; }; struct LuaConfiguration { bool allow_arbitrary_scripts = false; std::vector script_whitelist; }; struct Configuration { TwitchConfiguration twitch; KickCredentialsConfiguration kick_credentials; DatabaseConfiguration database; CommandConfiguration commands; OwnerConfiguration owner; UrlConfiguration url; TokenConfiguration tokens; RssConfiguration rss; LuaConfiguration lua; sol::table as_lua_table(std::shared_ptr luaState) const; }; std::optional parse_configuration_from_file( const std::string &file_path); }