mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2026-09-02 21:03:34 +03:00
# Description of Changes Redesign policies backend to treat sources a lot closer to how the frontend imagined them working (they're persistent now and have an API). Then connect the portal to the sources when mocks are off to allow for source creation in the UI. It's not particularly useful to do that right now because there's no policies UI, but I've tested manually that sources set up in the UI are usable by policies created via the API. I had to change the portal so that when mocks are off, it doesn't just hard crash when attempting to connect to all the backend APIs that don't exist yet. It'll still log the errors, but just continues on rendering the UI now. I also changed all the policies backend APIs to be gated behind a flag instead of behind the SaaS profile. This is because we haven't yet got the payment model sorted, but we're going to need this stuff running self-hosted to be able to test it locally.
76 lines
3.9 KiB
Properties
76 lines
3.9 KiB
Properties
# Stirling-PDF SaaS profile. Pure multi-tenant cloud.
|
|
# Activated when the :saas module is on the classpath.
|
|
|
|
# ---------- Datasource ----------
|
|
system.datasource.enableCustomDatabase=true
|
|
system.datasource.customDatabaseUrl=${SAAS_DB_URL:}
|
|
system.datasource.username=${SAAS_DB_USERNAME:postgres}
|
|
system.datasource.password=${SAAS_DB_PASSWORD:}
|
|
system.datasource.type=postgresql
|
|
|
|
# Override application.properties' default H2 URL so missing creds fail clearly.
|
|
spring.datasource.url=${SAAS_DB_URL:}
|
|
spring.datasource.username=${SAAS_DB_USERNAME:postgres}
|
|
spring.datasource.password=${SAAS_DB_PASSWORD:}
|
|
|
|
# ---------- DB schema / migrations ----------
|
|
spring.jpa.properties.hibernate.default_schema=stirling_pdf
|
|
spring.jpa.properties.hibernate.hbm2ddl.create_namespaces=true
|
|
|
|
spring.jpa.hibernate.ddl-auto=update
|
|
spring.flyway.enabled=true
|
|
spring.flyway.baseline-on-migrate=true
|
|
spring.flyway.locations=classpath:db/migration,classpath:db/migration/saas
|
|
spring.flyway.schemas=stirling_pdf
|
|
spring.flyway.default-schema=stirling_pdf
|
|
|
|
# ---------- Supabase JWT auth ----------
|
|
# Required: set SAAS_DB_PROJECT_REF via env.
|
|
app.supabase.project-ref=${SAAS_DB_PROJECT_REF:}
|
|
app.supabase.issuer=https://${app.supabase.project-ref}.supabase.co/auth/v1
|
|
app.supabase.expected-aud=${app.jwt.expected-aud:authenticated}
|
|
app.supabase.clock-skew-seconds=${app.jwt.clock-skew-seconds:120}
|
|
|
|
# Edge Function admin endpoint (used by billing/license rollup).
|
|
app.supabase.edge-function-url=https://${app.supabase.project-ref}.supabase.co/functions/v1
|
|
app.supabase.edge-function-secret=${SUPABASE_EDGE_FUNCTION_SECRET:}
|
|
|
|
# ---------- PAYG meter reporting ----------
|
|
# Posts billable usage to the Supabase `meter-payg-units` edge function in the JobChargeService
|
|
# close() afterCommit hook. Defaults to empty so unit tests / local dev are no-ops; set
|
|
# PAYG_METER_ENDPOINT in deployed envs to enable. Compose with the Supabase functions base via
|
|
# env (e.g. PAYG_METER_ENDPOINT=$SUPABASE_FUNCTIONS_URL/meter-payg-units) rather than templating
|
|
# here — concatenating an empty default would produce a half-valid URL.
|
|
# Auth rides the existing backend<->edge-fn shared secret (SUPABASE_EDGE_FUNCTION_SECRET, same
|
|
# one team-invitation-email uses) — the backend never holds the RLS-bypassing service-role key.
|
|
payg.meter.endpoint=${PAYG_METER_ENDPOINT:}
|
|
payg.meter.auth-token=${app.supabase.edge-function-secret:}
|
|
|
|
# Reconcile job: retries meter events logged to payg_meter_event_log but never confirmed posted
|
|
# (Stripe blip, edge-fn outage, pod crash mid-POST). Re-sends under the same idempotency key so
|
|
# Stripe dedups; only within Stripe's 24h window. Defaults are sensible; tune/disable via env.
|
|
payg.meter.reconcile.enabled=${PAYG_METER_RECONCILE_ENABLED:true}
|
|
payg.meter.reconcile.retry-delay=${PAYG_METER_RECONCILE_RETRY_DELAY:PT5M}
|
|
payg.meter.reconcile.batch-size=${PAYG_METER_RECONCILE_BATCH_SIZE:100}
|
|
payg.meter.reconcile-cron=${PAYG_METER_RECONCILE_CRON:0 */15 * * * *}
|
|
|
|
# ---------- PAYG customer portal ----------
|
|
# The Stripe billing-portal session is minted FE-direct: the Plan page calls the Supabase
|
|
# `create-customer-portal-session` edge function with the user's JWT (same pattern as checkout),
|
|
# and the function's SECURITY DEFINER RPC enforces team membership. No Java proxy, no backend
|
|
# config — return_url host allowlisting lives in the edge fn (PORTAL_ALLOWED_RETURN_HOSTS).
|
|
|
|
supabase.url=https://${app.supabase.project-ref}.supabase.co
|
|
|
|
spring.security.oauth2.resourceserver.jwt.jwk-set-uri=https://${app.supabase.project-ref}.supabase.co/auth/v1/.well-known/jwks.json
|
|
spring.security.oauth2.resourceserver.jwt.audiences=${app.supabase.expected-aud}
|
|
|
|
# ---------- Policies ----------
|
|
# Exposes the /api/v1/policies and /api/v1/sources controllers, engine, stores, and triggers.
|
|
policies.enabled=true
|
|
|
|
# ---------- Multi-tenant scoping ----------
|
|
# Restrict the signing user picker to the caller's team; SaaS must be 'team'
|
|
# or unrelated tenants leak emails to each other.
|
|
storage.signing.userListScope=team
|