#19 — link_url on campaign variants (migration 019) - ADD COLUMN link_url TEXT on campaign_variants - create_variant, upsert_variant, update_variant all carry link_url - RedditClient.post() supports kind=link when link_url set + body empty - RedditPostStrategy passes link_url from extra dict - poster.py merges link_url from variant into extra (same as slug/tags) - API VariantCreate/VariantUpdate schemas include link_url - CampaignDetail: link_url field in Add Variant form with copy button; link_url shown in variant list with clickable link + copy button - Variant button disabled if neither body nor link_url is set #18 — Multi-user team accounts (migrations 020-022) - 020: team_accounts table (display_name, platform, username, session_file) - 021: opportunities.assigned_to + post_as FK → team_accounts - 022: posts.posted_by_account_id FK → team_accounts - Store: list/get/get_by_username/create_team_account, assign_opportunity - API: GET/POST /api/v1/team; POST /api/v1/team/{id}/assign - config.py: sessions_dir added; reddit_session_file now points to sessions/alan_reddit.json (backward compat path kept) - scripts/migrate_sessions.py: one-shot move session.json → sessions/alan_reddit.json + creates placeholder files for future accounts - manage.sh: build (VITE_BASE_URL=/magpie/ npm build), serve (static), migrate-sessions subcommands added; login updated to new session path - Caddy: @magpie_no_session gate + handle /magpie/api* and /magpie* blocks added to menagerie.circuitforge.tech site block
44 lines
1.7 KiB
Python
44 lines
1.7 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
|
|
|
# Server
|
|
api_host: str = "0.0.0.0"
|
|
api_port: int = 8532
|
|
debug: bool = False
|
|
|
|
# Database
|
|
db_path: str = str(Path.home() / ".local" / "share" / "magpie" / "magpie.db")
|
|
|
|
# Session files — multi-user layout
|
|
# sessions_dir holds per-account JSON files: alan_reddit.json, cf_reddit.json, etc.
|
|
# reddit_session_file kept for backward compat; still used by the campaign scheduler
|
|
# until all callers are migrated to look up session via team_accounts.
|
|
sessions_dir: str = str(Path.home() / ".local" / "share" / "magpie" / "sessions")
|
|
reddit_session_file: str = str(Path.home() / ".local" / "share" / "magpie" / "sessions" / "alan_reddit.json")
|
|
|
|
# Scheduler
|
|
scheduler_enabled: bool = True
|
|
|
|
# Directus (CircuitForge website CMS)
|
|
directus_url: str = "http://172.31.0.4:8055"
|
|
directus_admin_token: str = ""
|
|
directus_admin_email: str = ""
|
|
directus_admin_password: str = ""
|
|
directus_network: str = "website_cf-internal"
|
|
|
|
# Signal scraper
|
|
scraper_enabled: bool = True
|
|
scraper_interval_mins: int = 30 # how often to poll (per full pass of all subs)
|
|
scraper_request_delay_secs: float = 2.0 # pause between sub requests to respect rate limits
|
|
scraper_fetch_limit: int = 25 # posts to fetch per sub per run (max 100)
|
|
scraper_user_agent: str = "Magpie/0.1 signal-monitor (by CircuitForge)"
|
|
|
|
|
|
def get_settings() -> Settings:
|
|
return Settings()
|