from __future__ import annotations from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): model_config = SettingsConfigDict( env_file=".env", env_file_encoding="utf-8", case_sensitive=False, ) # Filesystem mount where notes live (e.g. /mnt/aura/snotes) data_dir: str = "data/notes" # SQLite metadata + search index (local disk) database_path: str = "snotes.db" # TOML file defining slash "actions" (see snotes.toml) actions_file: str = "snotes.toml" # Fixed list of usernames, comma-separated (seeded at startup) users: str = "schmeeve,ilya" # Name of the shared space everyone can see common_space: str = "common" # Remote-access password (empty = no remote auth) remote_pass: str = "" # Secret used to sign session cookies secret_key: str = "change-me-in-production" # Subnet(s) considered "local" and allowed in without a password lan_cidrs: str = "192.168.1.0/24,127.0.0.1/32,::1/128" host: str = "0.0.0.0" port: int = 8000 log_level: str = "INFO" @property def user_list(self) -> list[str]: return [u.strip() for u in self.users.split(",") if u.strip()] @property def cidr_list(self) -> list[str]: return [c.strip() for c in self.lan_cidrs.split(",") if c.strip()] settings = Settings()