Add modular app structure for L2 server
- Create app factory with routers and templates - Auth, assets, activities, anchors, storage, users, renderers routers - Federation router for WebFinger and nodeinfo - Jinja2 templates for L2 pages - Config and dependency injection 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
56
app/config.py
Normal file
56
app/config.py
Normal file
@@ -0,0 +1,56 @@
|
||||
"""
|
||||
L2 Server Configuration.
|
||||
|
||||
Environment-based settings for the ActivityPub server.
|
||||
"""
|
||||
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@dataclass
|
||||
class Settings:
|
||||
"""L2 Server configuration."""
|
||||
|
||||
# Domain and URLs
|
||||
domain: str = os.environ.get("ARTDAG_DOMAIN", "artdag.rose-ash.com")
|
||||
l1_public_url: str = os.environ.get("L1_PUBLIC_URL", "https://celery-artdag.rose-ash.com")
|
||||
effects_repo_url: str = os.environ.get("EFFECTS_REPO_URL", "https://git.rose-ash.com/art-dag/effects")
|
||||
ipfs_gateway_url: str = os.environ.get("IPFS_GATEWAY_URL", "")
|
||||
|
||||
# L1 servers
|
||||
l1_servers: list = None
|
||||
|
||||
# Cookie domain for cross-subdomain auth
|
||||
cookie_domain: str = None
|
||||
|
||||
# Data directory
|
||||
data_dir: Path = None
|
||||
|
||||
# JWT settings
|
||||
jwt_secret: str = os.environ.get("JWT_SECRET", "")
|
||||
jwt_algorithm: str = "HS256"
|
||||
access_token_expire_minutes: int = 60 * 24 * 30 # 30 days
|
||||
|
||||
def __post_init__(self):
|
||||
# Parse L1 servers
|
||||
l1_str = os.environ.get("L1_SERVERS", "https://celery-artdag.rose-ash.com")
|
||||
self.l1_servers = [s.strip() for s in l1_str.split(",") if s.strip()]
|
||||
|
||||
# Cookie domain
|
||||
env_cookie = os.environ.get("COOKIE_DOMAIN")
|
||||
if env_cookie:
|
||||
self.cookie_domain = env_cookie
|
||||
else:
|
||||
parts = self.domain.split(".")
|
||||
if len(parts) >= 2:
|
||||
self.cookie_domain = "." + ".".join(parts[-2:])
|
||||
|
||||
# Data directory
|
||||
self.data_dir = Path(os.environ.get("ARTDAG_DATA", str(Path.home() / ".artdag" / "l2")))
|
||||
self.data_dir.mkdir(parents=True, exist_ok=True)
|
||||
(self.data_dir / "assets").mkdir(exist_ok=True)
|
||||
|
||||
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user