# Copy to .deploy/.env and fill in your values (.deploy/ is gitignored)
#   cp -r .deploy.example .deploy
DINARY_DEPLOY_HOST=ubuntu@<PUBLIC_IP>
# DINARY_TUNNEL=tailscale  # tailscale (default) | cloudflare | none

# Optional: Litestream SFTP replica (VM2). Only consumed by
# ``inv setup-replica`` and the replica URL rendered by
# ``inv setup-replica``; ``inv deploy`` ignores it. Must be a
# host reachable over SSH as the ``ubuntu`` user (Tailscale MagicDNS
# name recommended so rotations do not break deploys). Leave unset
# on hosts that only run the primary.
# DINARY_REPLICA_HOST=ubuntu@dinary-replica
# DINARY_LITESTREAM_RETENTION=168h  # WAL history window; default 7 days

# First-deploy ONLY: the ISO-4217 accounting currency that will be
# baked into every expenses.amount / income.amount row on disk. On
# the very first ``init_db`` against an empty dinary.db the value
# is copied into ``app_metadata.accounting_currency`` and becomes the
# DB's source of truth. After that the env var is purely advisory —
# leave it commented out and the server will read the anchored value
# back from the DB on startup. If you DO leave it set, init_db checks
# it against the stored value and refuses to start on mismatch (the
# guard that catches accidental typos silently corrupting the ledger).
# Default on a fresh DB: EUR.
# DINARY_ACCOUNTING_CURRENCY=EUR

# Optional: the PWA / API user-facing default currency. This is what
# the UI works in and the fallback for ``POST /api/expenses`` requests
# that omit ``currency``. It only influences INPUT defaulting — it is
# NOT persisted and does not affect stored amounts (those are always in
# the accounting currency above). Safe to flip any time (e.g. if the
# operator relocates). Default: RSD.
# DINARY_APP_CURRENCY=RSD

# Optional: enable sheet logging (append each expense to Google Sheets).
# Accepts a spreadsheet ID or a full browser URL. Leave empty to disable.
# DINARY_SHEET_LOGGING_SPREADSHEET=https://docs.google.com/spreadsheets/d/YOUR_SPREADSHEET_ID/edit

# Optional: how often the in-process periodic drain re-tries the
# sheet_logging_jobs queue. Default 300s. 0 disables periodic drain
# (per-expense fire-and-forget still runs).
# DINARY_SHEET_LOGGING_DRAIN_INTERVAL_SEC=300

# Optional: hard cap on _drain_one_job calls per single drain_pending
# invocation, summed across years. Default 15. Bounds Sheets API quota
# usage in the worst case (mass backlog after a long outage).
# DINARY_SHEET_LOGGING_DRAIN_MAX_ATTEMPTS_PER_ITERATION=15

# Optional: synchronous sleep between two consecutive _drain_one_job
# calls, executed inside the asyncio.to_thread worker (does NOT block
# the FastAPI event loop). Default 1.0s = instantaneous ceiling of
# ~1 attempt/sec inside one sweep; combined with max_attempts the
# sustained rate stays at 3-9 Sheets API calls/min. Set to 0 to
# disable (tests).
# DINARY_SHEET_LOGGING_DRAIN_INTER_ROW_DELAY_SEC=1.0

# Optional: TTL in days for the sheet_logging_jobs queue. Rows whose
# expense.date is older than today minus this many days are silently
# skipped (left in the table). Default 90. 0 disables the TTL filter.
# DINARY_SHEET_LOGGING_DRAIN_MAX_AGE_DAYS=90
