Skip to content

Refactor configuration #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

NMertsch
Copy link
Contributor

@NMertsch NMertsch commented Apr 27, 2025

Fixes #139
Fixes #118

Drop ansible, yarl, arrow, certifi

We don't use any of these packages. Ansible is used during deployment, but it is installed during the GitHub Action execution.

Drop python-dotenv

The program now expects the environment variables DISCORD_BOT_TOKEN and PRETIX_TOKEN without falling back to .secrets.

compose.yml now uses secrets as env-file instead of binding the file into the container.

Split configuration, use pydantic

Every cog (besides Ping) now has its own configuration class. Configuration is modelled using pydantic.BaseModel.

Refactor $participants command cog

  • Dynamically create list of roles, instead of relying on hard-coded configuration.
  • Refactor into a single-file module (like Ping) instead of multi-file extension.

Use channel names instead of IDs in config, simplify registration and program notification code

The configuration is now server-agnostic, and the code contains less indirection.

General
* User __name__ as logger name everywhere

'$participants' command:
* Move from extension module to simple cog
* Use dynamic role list instead of hard-coded role names
* Add channel visibility check

bot.py
* Simplify and refactor

program notifications
* Use channel names in config, not IDs
* Simplify notification logic
* Config: Require file path explicitly
* run-bot: Expect config file path as --config-file or CONFIG_FILE
* README: Update
* uv: Remove python-dotenv and certifi dependencies
* Move config files to repo root
* Docker: Expect CONFIG_FILE
* Compose: Specify config file and .secrets
Model all configuration as cog-specific pydantic.BaseModels.
Remove certifi, yarl and arrow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove ansible from dev dependencies Config: Store role names instead of IDs
1 participant