- JSON.stringify inside onclick="..." cut the handler short at its first quote, so "Otwórz sprawę" died on a syntax error and no matter could be opened from the console. Older than this branch. All six sites now go through jsArg. - The default rate is checked before saving: "1.500,00" parsed as 1,50 zł. - A pending check is never cut off GET /conflicts: the new badge points at it. - A second matter no longer takes an enquiry off its first. - A rejected 401 opens the sign-in screen, and a quick tab switch cannot replace the page with an error. - Copy that said something untrue: the art. 115 k.c. note, "do przypisania" on a form that also files outgoing post, "w rejestrze" on the AML prompt. - "kierownik" stays in the role's label, Polish plurals on the list counts. - Two operator notes still named Administracja. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
232 lines
15 KiB
Bash
232 lines
15 KiB
Bash
# ─────────────────────────────────────────────────────────────────────────────
|
|
# Sygna — copy to .env and edit. On Windows write it WITHOUT a BOM:
|
|
# [System.IO.File]::WriteAllText("$PWD\.env", (Get-Content .env.example -Raw))
|
|
# (PowerShell's Out-File -Encoding utf8 adds a BOM, which pydantic-settings then
|
|
# folds into the first key name.)
|
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
|
|
# Core. Defaults fail closed: production hides error detail and enables Secure cookies.
|
|
# Set development explicitly for local plain-HTTP work.
|
|
APP_ENV=production
|
|
APP_BASE_URL=http://localhost:8041
|
|
|
|
# Where this module is mounted on the platform: /sygna. Empty = standalone, at the root of its
|
|
# own host. Whatever is set here reaches uvicorn as --root-path too, and the front door must
|
|
# strip the same prefix (Atrium forwards /sygna/* without it) — the two are one decision.
|
|
ROOT_PATH=
|
|
|
|
# ── Database ─────────────────────────────────────────────────────────────────
|
|
# Runtime uses the least-privilege `app` role; Alembic uses `migrator`.
|
|
POSTGRES_DB=sygna
|
|
POSTGRES_PASSWORD=change_me_super
|
|
DB_APP_PASSWORD=change_me_app
|
|
DB_MIGRATOR_PASSWORD=change_me_migrator
|
|
|
|
DATABASE_URL=postgresql+pg8000://app:change_me_app@postgres:5432/sygna
|
|
MIGRATION_DATABASE_URL=postgresql+pg8000://migrator:change_me_migrator@postgres:5432/sygna
|
|
|
|
# The runtime role's name: the role DATABASE_URL logs in as. The grants migration (0002) grants
|
|
# it DML and fails loudly if it does not exist.
|
|
DB_APP_ROLE=app
|
|
# The runtime connection pool, per backend process: up to DB_POOL_SIZE + DB_MAX_OVERFLOW.
|
|
DB_POOL_SIZE=5
|
|
DB_MAX_OVERFLOW=10
|
|
# TLS rule: a database host that is not local ("", localhost, 127.0.0.1, ::1 or `postgres`) must
|
|
# say sslmode=verify-full in its URL, or migrate and the backend refuse to start before anything
|
|
# connects. A private database on a trusted network that truly needs no TLS is listed here instead
|
|
# (comma-separated). There is no other opt-out.
|
|
DB_LOCAL_HOSTS=
|
|
|
|
# ── Managed PostgreSQL (optional; replaces the local postgres service) ────────
|
|
# With docker-compose.managed-db.yml (runbook: db/managed/README.md) the settings above are
|
|
# replaced by these, uncommented. POSTGRES_* and DB_*_PASSWORD are then unused (no local postgres).
|
|
# - Host and port from the provider's connection details. Through a pooler, its SESSION mode,
|
|
# never transaction mode (it breaks prepared statements; port 6543 on some providers).
|
|
# - Some poolers want the tenant in the user name: then it is <role>.<tenant>, i.e.
|
|
# sygna_app.<tenant> for the runtime and sygna_migrator.<tenant> for migrations; otherwise the
|
|
# plain role names. Never the platform admin, and the two always differ.
|
|
# - URL-encode each password with urllib.parse.quote(password, safe=""), never by hand: a
|
|
# % @ : / ? # breaks the URL, and Compose substitutes a $ ($HOME becomes a directory).
|
|
# - sslmode=verify-full against the provider's root CA (downloaded from its dashboard), which
|
|
# the override mounts at /run/certs/db-ca.crt from MANAGED_DB_CA_FILE; leave sslrootcert out
|
|
# to verify against the system trust store instead. A URL for a host that is not local is
|
|
# refused without sslmode=verify-full, before anything connects (config.py); deploy_check.py
|
|
# --env refuses it too. The engine alone would still take sslmode=require and verify-ca
|
|
# (neither checks the host name) and a URL with no sslmode.
|
|
# DATABASE_URL=postgresql+pg8000://sygna_app.<tenant>:<url-encoded password>@<host>:5432/postgres?sslmode=verify-full&sslrootcert=/run/certs/db-ca.crt
|
|
# MIGRATION_DATABASE_URL=postgresql+pg8000://sygna_migrator.<tenant>:<url-encoded password>@<host>:5432/postgres?sslmode=verify-full&sslrootcert=/run/certs/db-ca.crt
|
|
# DB_APP_ROLE=sygna_app
|
|
# MANAGED_DB_CA_FILE=./certs/db-ca.crt
|
|
# The four apps share the database's connection limit, with the provider's own services. Count
|
|
# DB_POOL_SIZE + DB_MAX_OVERFLOW + 1 per app (the +1 is a check or one-shot beside the backend):
|
|
# 16 each, 64 for four, with the defaults, which fits a limit of 90; for a limit of 60 set 3 + 2
|
|
# in EVERY app. Through a pooler in session mode, its pool size per role must be at least
|
|
# DB_POOL_SIZE + DB_MAX_OVERFLOW + 1, or a client past it waits and is then refused. Not yet
|
|
# measured on a real managed database: db/managed/README.md.
|
|
# DB_POOL_SIZE=5
|
|
# DB_MAX_OVERFLOW=10
|
|
# Opt-in only: gives the long-running backend the migrator URL, so the console's restore works.
|
|
# It also lets that backend rewrite the audit log; the default is the one-shot python -m app.restore.
|
|
# BACKEND_MIGRATION_DATABASE_URL=
|
|
|
|
# ── Storage ──────────────────────────────────────────────────────────────────
|
|
DATA_DIR=/data
|
|
|
|
# ── Building the image ───────────────────────────────────────────────────────
|
|
# dredd-core is a private repository, so `docker compose build` needs DREDD_CORE_TOKEN — a
|
|
# fine-grained, read-only GitHub PAT — in the environment of whoever runs the build. It is NOT a
|
|
# setting of the running application and does not belong in this file: compose hands it to the
|
|
# build stage as a BuildKit secret, and no running container ever sees it.
|
|
# DREDD_CORE_TOKEN=github_pat_... docker compose up -d --build
|
|
|
|
# ── Secret key ───────────────────────────────────────────────────────────────
|
|
# Encrypts each user's Galena app token at rest (AES-256-GCM, key derived with Argon2id). Nothing
|
|
# else in Sygna is stored recoverably — passwords are hashes, session tokens are digests — and a
|
|
# Galena token is the exception only because Sygna has to send it to Galena.
|
|
#
|
|
# KEEP IT. Backups deliberately exclude .env, so restoring onto a host without this exact value
|
|
# leaves every stored token unreadable and each user re-enters theirs. Generate one with:
|
|
# python -c "import secrets; print(secrets.token_urlsafe(48))"
|
|
# Empty = Sygna refuses to store a Galena token rather than storing it in the clear.
|
|
SECRET_KEY=
|
|
|
|
# ── One platform, one account ────────────────────────────────────────────────
|
|
# Empty (the default) is the STANDALONE deployment: Sygna owns its accounts, signs its own people
|
|
# in, and every screen below works exactly as it always has.
|
|
#
|
|
# Set it to the platform's neutral identity schema (dredd) and Sygna becomes a MODULE: it READS
|
|
# the shared accounts and never writes them. Its database role holds a column-restricted SELECT on
|
|
# app_user, SELECT plus a three-column UPDATE on session, and SELECT on module_moderator — it
|
|
# cannot create an account, elevate one, or mint a credential. The enforcement is that grant, not a
|
|
# missing screen, which is why the app refuses those writes with a sentence rather than a 500.
|
|
#
|
|
# Three things have to be true before this is set, and each of them refuses loudly otherwise:
|
|
# 1. this app has been PROVISIONED with --identity-schema / --identity-owner, as the platform
|
|
# admin (db/managed/provision.sql) — that is what grants its two roles USAGE and puts the
|
|
# schema on their search_path, after the app's own;
|
|
# 2. the hub has created the three tables there and granted this app its tier;
|
|
# 3. every account in this schema exists in the shared store, matched on lower(email). Revision
|
|
# 0003 raises by name if one does not, rather than orphaning it.
|
|
IDENTITY_SCHEMA=
|
|
# This module's slug on the platform — what a MODERATOR of Sygna is granted on. Only read when
|
|
# IDENTITY_SCHEMA is set.
|
|
MODULE_SLUG=sygna
|
|
# Where people sign in. One origin, one module per path, so the console reaches the hub at
|
|
# ../<slug>/ relative to its own base URL: nothing absolute to configure. Only used on a platform.
|
|
HUB_SLUG=atrium
|
|
|
|
# ── Auth / sessions ──────────────────────────────────────────────────────────
|
|
# The cookie's name. One account means one cookie: on the platform every app in the family is set
|
|
# to the same value (dredd_session), and because the family runs at ONE origin that is the entire
|
|
# mechanism of single sign-on — no Domain attribute, no signed assertion, no redirect dance. The
|
|
# default keeps a standalone Sygna on its own name, and the old name is still accepted for one
|
|
# request after a rename so the cutover does not sign everybody out as it happens. Set it TOGETHER
|
|
# with IDENTITY_SCHEMA: the backend refuses to start with only one of the two (a schema without the
|
|
# hub's cookie is a dead module; the hub's cookie without the schema overwrites the platform session
|
|
# and signs everybody out of Atrium).
|
|
SESSION_COOKIE_NAME=sygna_session
|
|
SESSION_TTL_HOURS=12
|
|
LOGIN_MAX_ATTEMPTS=5
|
|
LOGIN_LOCKOUT_MINUTES=15
|
|
# Empty = auto-detect from the request scheme (Secure over HTTPS only). Never key
|
|
# this off APP_ENV — a Secure cookie over plain HTTP is dropped and login "doesn't stick".
|
|
SESSION_COOKIE_SECURE=
|
|
|
|
# CORS — empty by default (same-origin design). Comma-separated origins for a
|
|
# separately-served console in dev, e.g. http://localhost:8041
|
|
CORS_ALLOW_ORIGINS=
|
|
|
|
# ── Bootstrap admin (seed) ───────────────────────────────────────────────────
|
|
BOOTSTRAP_ADMIN_EMAIL=admin@example.com
|
|
BOOTSTRAP_ADMIN_PASSWORD=admin12345
|
|
# Seed a small demo firm so the app isn't empty on first run.
|
|
SEED_DEMO=true
|
|
|
|
# ── Reminders ────────────────────────────────────────────────────────────────
|
|
# The scheduler is an in-process asyncio task. In a multi-instance deploy run it on ONE
|
|
# instance only and set false on the others — duplicate runs are harmless (every reminder is
|
|
# deduplicated by a database constraint) but they are wasted work.
|
|
REMINDERS_ENABLED=true
|
|
REMINDER_INTERVAL_HOURS=6
|
|
|
|
# ── Galena (the document store) ──────────────────────────────────────────────
|
|
# Sygna calls Galena's REST API as the acting user, so Galena's authz stays the single
|
|
# authority on document access. Empty base URL → the integration is a no-op and matters
|
|
# are created without a case file (the UI says so).
|
|
#
|
|
# On the platform this is Galena's PUBLIC base — http://<site>/galena — so the call hairpins
|
|
# back out through the shared reverse proxy. Deliberately not an internal service name: no
|
|
# backend shares a Docker network with another backend, so galena-backend:8000 does not
|
|
# resolve from here.
|
|
GALENA_BASE_URL=
|
|
# The console links here when a user opens a matter's case file. Defaults to
|
|
# GALENA_BASE_URL when empty.
|
|
GALENA_CONSOLE_URL=
|
|
# Where new case-file projects are created in Galena's tree (a node id). Empty →
|
|
# Sygna asks Galena for the acting user's personal workspace.
|
|
GALENA_CASEFILE_PARENT_ID=
|
|
GALENA_TIMEOUT_SECONDS=15
|
|
|
|
# Render the case file INSIDE Sygna's matter screen rather than behind a link.
|
|
# Needs two things, both of them, or you get a blank frame:
|
|
# 1. this flag true, and GALENA_CONSOLE_URL set;
|
|
# 2. Galena run with GALENA_FRAME_ANCESTORS naming Sygna's origin — at one origin that is
|
|
# the platform's own address, e.g. GALENA_FRAME_ANCESTORS=http://<site>
|
|
# (shipped in Galena commit 6926a03).
|
|
# The cookie half of this is gone: one origin means Galena's session cookie is already this
|
|
# origin's cookie, so there is nothing to scope to a parent domain. Leave false until 2 is
|
|
# done — the console falls back to a link and says why.
|
|
GALENA_EMBED=false
|
|
|
|
# ── Health ───────────────────────────────────────────────────────────────────
|
|
# GET /healthz liveness — is the process up (never touches the database)
|
|
# GET /healthz?deep=1 readiness — SELECT 1; 503 when the database is unreachable
|
|
# Point a container restart policy at the first and a load balancer at the second. Using the
|
|
# first for both is how a dead instance keeps its share of the traffic.
|
|
|
|
# ── The edge (no reverse proxy) ──────────────────────────────────────────────
|
|
# The backend serves the console and sets its own security headers; docker-compose.yml publishes it
|
|
# on :8041, plain HTTP. For TLS put your own terminator in front, or run Sygna on the platform.
|
|
#
|
|
# Which upstream IPs uvicorn trusts for X-Forwarded-For / X-Forwarded-Proto, so the real client IP
|
|
# lands in the audit log. Empty = loopback only (the image's default), right for this stack, where
|
|
# nothing sits in front of the backend. Behind your own TLS terminator, set its address or subnet;
|
|
# never `*`. docker-compose.yml sets it empty, overriding this line.
|
|
FORWARDED_ALLOW_IPS=
|
|
# Who may frame Sygna: 'none' (default; X-Frame-Options DENY) or 'self' (SAMEORIGIN). Anything else
|
|
# refuses start-up.
|
|
FRAME_ANCESTORS='none'
|
|
|
|
# ── OpenTelemetry (opt-in) ───────────────────────────────────────────────────
|
|
OTEL_ENABLED=false
|
|
OTEL_SERVICE_NAME=sygna-backend
|
|
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
|
|
|
|
# ── E-mail (SMTP) ────────────────────────────────────────────────────────────
|
|
# Leave SMTP_HOST empty and notifications stay in-app — a clean no-op, not an error.
|
|
# Port 587 with STARTTLS is the usual shape; for implicit TLS on 465 set
|
|
# SMTP_STARTTLS=false and SMTP_SSL=true.
|
|
#
|
|
# What the message SAYS is set in the console (Ustawienia Sygny → Poczta, integracje i kopie), not here:
|
|
# it defaults to naming no client, matter or deadline, because mail leaves the firm.
|
|
SMTP_HOST=
|
|
SMTP_PORT=587
|
|
SMTP_USER=
|
|
SMTP_PASSWORD=
|
|
SMTP_STARTTLS=true
|
|
SMTP_SSL=false
|
|
SMTP_FROM=
|
|
SMTP_FROM_NAME=Sygna
|
|
# Seconds to wait on connect/login/send before giving up. The sweep retries next cycle.
|
|
SMTP_TIMEOUT_SECONDS=20
|
|
|
|
# ── App tokens ───────────────────────────────────────────────────────────────
|
|
# Named, revocable credentials for desktop/CLI clients, so they never store a password.
|
|
# The window is an IDLE timeout: every use slides it forward, so a token in regular use keeps
|
|
# working while one that is exfiltrated and parked expires on its own.
|
|
# Ported from Galena and deliberately identical — the two share the session table (SHARED.md).
|
|
APP_TOKENS_ENABLED=true
|
|
APP_TOKEN_IDLE_DAYS=30
|
|
APP_TOKEN_MAX_IDLE_DAYS=365
|
|
APP_TOKEN_RENEW_AFTER_HOURS=12
|