16 lines
664 B
Python
16 lines
664 B
Python
from dataclasses import dataclass
|
|
import os
|
|
|
|
@dataclass(frozen=True)
|
|
class Settings:
|
|
github_token: str = ""
|
|
sharepoint_site_url: str = "https://sharepoint.invalid"
|
|
allowed_repositories: tuple[str, ...] = ()
|
|
require_approval: bool = True
|
|
environment: str = "development"
|
|
|
|
@classmethod
|
|
def from_env(cls) -> "Settings":
|
|
repos = tuple(x.strip() for x in os.getenv("ALLOWED_REPOSITORIES", "").split(",") if x.strip())
|
|
return cls(os.getenv("GITHUB_TOKEN", ""), os.getenv("SHAREPOINT_SITE_URL", cls.sharepoint_site_url), repos, os.getenv("REQUIRE_APPROVAL", "true").lower() != "false", os.getenv("ENVIRONMENT", "development"))
|