Joint-Teapot/joint_teapot/config.py
Salty Fish d437cb8b18
feat: basic Mattermost integration functionality (#10)
* Fix small error in venv setup guide

* Add functions for mm integration

Implemented: create channels for groups
Implemented: create webhooks on both sides for groups
As for now these functions can only be called from the Python REPL

* Add commands for mm channel/webhook creation

Implemented: archive a given list of channels (unused)

* Add new features to README

* Add filter argument for channel/webhook creation

This filter argument is optional and defaults to an empty string,
meaning no filtering is required. This is helpful for excluding previous
project repos or irrelevant repos.
Also added detection logic to handle an exception where a student is on
MM but not in the target team. (Perhaps we would want to invite that
student immediately?)

* Update README

Clarify platform difference for venv
Restructure Commands & Features section to make room for better docs

* Remove unused function from Canvas worker

* Add gitea domain name and suffix config items

Align with the mm worker, and grant more flexibility
Also changed terminology to be clearer (`domain_name` instead of `url`)

* Code style and quality updates

* Add domain name and suffix config items for Canvas

* Return to using dicts to represent groups

Removed `StudentGroup` at BoYanZh's request
2022-05-27 12:10:08 +08:00

49 lines
960 B
Python

from functools import lru_cache
from pydantic import BaseSettings
class Settings(BaseSettings):
"""
Define the settings (config).
"""
# canvas
canvas_domain_name: str = "umjicanvas.com"
canvas_suffix: str = "/"
canvas_access_token: str = ""
canvas_course_id: int = 0
# gitea
gitea_domain_name: str = "focs.ji.sjtu.edu.cn"
gitea_suffix: str = "/git"
gitea_access_token: str = ""
gitea_org_name: str = ""
# git
repos_dir: str = "./repos"
# mattermost
mattermost_domain_name: str = "focs.ji.sjtu.edu.cn"
mattermost_suffix: str = "/mm"
mattermost_access_token: str = ""
mattermost_team: str = ""
# sid
joj_sid: str = ""
# log file
log_file_path: str = "joint-teapot.log"
class Config:
env_file = ".env"
env_file_encoding = "utf-8"
@lru_cache()
def get_settings() -> Settings:
return Settings()
settings: Settings = get_settings()