Files
CIAgent/apps/api/app/models/system_secret.py
T
saksham 1a4c80958f Initial commit: CI Agent competitive-intelligence monitoring app
FastAPI + Celery + Next.js + Postgres/Redis app with company monitoring,
source collection, LLM-based change analysis, enrichment, and account
security (Turnstile, escalating lockout, email verification).
2026-08-05 10:48:20 -04:00

25 lines
962 B
Python

"""A server-wide secret (e.g. Turnstile site key/secret), encrypted at rest
(app/core/crypto.py). Unlike UserApiKey, this isn't scoped to a user - it's
one value shared by the whole app, admin-editable from the Settings page
instead of only via .env. When set,
app/services/system_secret_service.py's get_effective_settings substitutes
it in place of the server's global .env-configured value - see that module
for the full fallback logic."""
from __future__ import annotations
from sqlalchemy import Enum, Text
from sqlalchemy.orm import Mapped, mapped_column
from app.db.base import Base, TimestampMixin, UUIDPrimaryKeyMixin
from app.models.enums import SystemSecretKey
class SystemSecret(Base, UUIDPrimaryKeyMixin, TimestampMixin):
__tablename__ = "system_secrets"
key: Mapped[SystemSecretKey] = mapped_column(
Enum(SystemSecretKey, native_enum=False, length=32), unique=True
)
encrypted_value: Mapped[str] = mapped_column(Text)