first pass?
This commit is contained in:
48
backend/config.py
Normal file
48
backend/config.py
Normal file
@@ -0,0 +1,48 @@
|
||||
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"
|
||||
|
||||
# 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"
|
||||
|
||||
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()
|
||||
Reference in New Issue
Block a user