sidequest_common.settings ========================= .. py:module:: sidequest_common.settings .. autoapi-nested-parse:: Environment-driven settings shared by the API and the bot. Each concern has its own env prefix: ``DB_``, ``API_``, ``DISCORD_``, ``WEB_``. Attributes ---------- .. autoapisummary:: sidequest_common.settings.MIN_SESSION_SECRET_LENGTH Classes ------- .. autoapisummary:: sidequest_common.settings.APISettings sidequest_common.settings.DatabaseSettings sidequest_common.settings.DiscordSettings sidequest_common.settings.WebSettings Module Contents --------------- .. py:class:: APISettings Bases: :py:obj:`pydantic_settings.BaseSettings` API settings (``API_*``). ``KEY`` is the shared secret the bot sends as ``X-API-Key``; both services must agree on it. ``URL`` is where the bot reaches the API. .. py:attribute:: DEBUG :type: bool :value: False .. py:attribute:: HOST :type: str :value: '127.0.0.1' .. py:attribute:: KEY :type: pydantic.SecretStr .. py:attribute:: PORT :type: int :value: 8000 .. py:attribute:: URL :type: str :value: 'http://localhost:8000' .. py:attribute:: model_config .. py:class:: DatabaseSettings Bases: :py:obj:`pydantic_settings.BaseSettings` Database connection settings (``DB_*``). .. py:attribute:: ECHO :type: bool :value: False .. py:attribute:: POOL_DISABLE :type: bool :value: False .. py:attribute:: URL :type: str :value: 'postgresql+asyncpg://sidequest:sidequest@localhost:55432/sidequest' .. py:attribute:: model_config .. py:class:: DiscordSettings Bases: :py:obj:`pydantic_settings.BaseSettings` Discord bot settings (``DISCORD_*``). ``GUILD_ID`` is optional; when set, slash commands sync to that guild instantly instead of globally. .. py:attribute:: GUILD_ID :type: int | None :value: None .. py:attribute:: TOKEN :type: pydantic.SecretStr .. py:attribute:: model_config .. py:class:: WebSettings Bases: :py:obj:`pydantic_settings.BaseSettings` Member hub / website settings (``WEB_*``). Discord OAuth2 login (scopes ``identify guilds.members.read``) for guild members, guild events, and addons. ``DISCORD_CLIENT_ID``/``DISCORD_CLIENT_SECRET`` are the OAuth *application* credentials (separate from the bot's ``DISCORD_TOKEN``); when either is unset the app still boots, but ``/auth/discord/login`` returns 503. ``BATTLENET_CLIENT_ID``/``BATTLENET_CLIENT_SECRET`` (a develop.battle.net API client) let signed-in members link their Battle.net account; when unset, linking redirects back to the account page with an explanation. .. py:attribute:: BASE_URL :type: str :value: 'http://localhost:8000' .. py:attribute:: BATTLENET_CLIENT_ID :type: str | None :value: None .. py:attribute:: BATTLENET_CLIENT_SECRET :type: pydantic.SecretStr | None :value: None .. py:attribute:: COOKIE_SECURE :type: bool :value: False .. py:attribute:: DISCORD_CLIENT_ID :type: str | None :value: None .. py:attribute:: DISCORD_CLIENT_SECRET :type: pydantic.SecretStr | None :value: None .. py:attribute:: GM_ROLE_IDS :type: Annotated[list[int], pydantic_settings.NoDecode] :value: [1564678042381586532] .. py:attribute:: GUILD_ID :type: int :value: 1564671275316543508 .. py:attribute:: OFFICER_ROLE_IDS :type: Annotated[list[int], pydantic_settings.NoDecode] :value: [1564678042381586532, 1564678035117178960] .. py:attribute:: SESSION_SECRET :type: pydantic.SecretStr | None :value: None .. py:property:: battlenet_configured :type: bool Whether both Battle.net OAuth client credentials are set. .. py:attribute:: model_config .. py:property:: oauth_configured :type: bool Whether both Discord OAuth app credentials are set. .. py:data:: MIN_SESSION_SECRET_LENGTH :value: 32