diff options
-rw-r--r-- | arthur/__main__.py | 2 | ||||
-rw-r--r-- | arthur/apis/cloudflare/zones.py | 2 | ||||
-rw-r--r-- | arthur/config.py | 5 | ||||
-rw-r--r-- | poetry.lock | 2 | ||||
-rw-r--r-- | pyproject.toml | 1 |
5 files changed, 7 insertions, 5 deletions
diff --git a/arthur/__main__.py b/arthur/__main__.py index d5cfffd..53e1fb3 100644 --- a/arthur/__main__.py +++ b/arthur/__main__.py @@ -31,7 +31,7 @@ async def main() -> None: intents=intents, ) async with arthur.instance as bot: - await bot.start(CONFIG.token) + await bot.start(CONFIG.token.get_secret_value()) with arthur.logger.catch(): diff --git a/arthur/apis/cloudflare/zones.py b/arthur/apis/cloudflare/zones.py index 1139d25..4e017f8 100644 --- a/arthur/apis/cloudflare/zones.py +++ b/arthur/apis/cloudflare/zones.py @@ -4,7 +4,7 @@ import aiohttp from arthur.config import CONFIG -AUTH_HEADER = {"Authorization": f"Bearer {CONFIG.cloudflare_token}"} +AUTH_HEADER = {"Authorization": f"Bearer {CONFIG.cloudflare_token.get_secret_value()}"} async def list_zones( diff --git a/arthur/config.py b/arthur/config.py index 66e89a7..9743667 100644 --- a/arthur/config.py +++ b/arthur/config.py @@ -1,5 +1,6 @@ """Utilities for interacting with the config for King Arthur.""" +import pydantic from pydantic_settings import BaseSettings @@ -12,7 +13,7 @@ class Config( """Configuration for King Arthur.""" # Discord bot token - token: str + token: pydantic.SecretStr # Discord bot prefix prefixes: tuple[str, ...] = ("arthur ", "M-x ") @@ -21,7 +22,7 @@ class Config( devops_role: int = 409416496733880320 # Token for authorising with the Cloudflare API - cloudflare_token: str + cloudflare_token: pydantic.SecretStr # Guild id guild_id: int = 267624335836053506 diff --git a/poetry.lock b/poetry.lock index d7cb146..785814f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1324,4 +1324,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "3.11.*" -content-hash = "b6af221acaa81f9b750cce4643e8716327f614bef8e353e9468697c3139a0f4e" +content-hash = "6d5e250a33c244e44aefccf4a915a97c88af946ba4981d2794b8ee31eddcca87" diff --git a/pyproject.toml b/pyproject.toml index 10429f2..697df7a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,6 +11,7 @@ python = "3.11.*" # See https://bot-core.pythondiscord.com/ for docs. pydis-core = "10.7.0" +pydantic = "2.6.0" pydantic-settings = "2.1.0" loguru = "0.7.2" kubernetes_asyncio = "29.0.0" |