Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

Working local Saas (#6450)

ConnorYoh05b80fbe4fa5
diff --git a/.env.saas.example b/.env.saas.example
new file mode 100644
index 0000000000..d9d787fe07
--- /dev/null
+++ b/.env.saas.example
@@ -0,0 +1,34 @@
+###############################################################################
+# Stirling-PDF SaaS local environment template.
+#
+# Copy this file to `.env.saas.local` (gitignored) and fill in real values.
+# Loaded by `task backend:dev:saas` via Taskfile's `dotenv:` directive, then
+# read by Spring Boot's `${...}` placeholders in application-saas.properties
+# and application-dev.properties.
+#
+# DO NOT commit `.env.saas.local`. Only `.env.saas.example` is checked in.
+###############################################################################
+
+# ---------- Supabase project ----------
+# Project reference (the subdomain part of <ref>.supabase.co). Required.
+# Example dev project:
+SAAS_DB_PROJECT_REF=
+
+# Edge function secret used by billing/license rollup calls.
+SUPABASE_EDGE_FUNCTION_SECRET=
+
+# ---------- Database (saas profile) ----------
+# Direct JDBC URL to the Supabase Postgres. Required when running the plain
+# `saas` profile (i.e. without `--spring.profiles.include=dev`).
+# Example: jdbc:postgresql://db.<project-ref>.supabase.co:5432/postgres
+SAAS_DB_URL=
+SAAS_DB_USERNAME=postgres
+SAAS_DB_PASSWORD=
+
+# ---------- Database (dev profile overrides) ----------
+# Used when `--spring.profiles.include=dev` is active. The dev profile
+# defaults the URL/username to the shared dev Supabase project, but the
+# password must still be provided here.
+SAAS_DEV_DB_URL=
+SAAS_DEV_DB_USERNAME=postgres
+SAAS_DEV_DB_PASSWORD=
diff --git a/.gitignore b/.gitignore
index 261b2a40ae..5c3bd57cc9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -174,6 +174,7 @@ venv.bak/
# Env files (secrets / local overrides). Subproject .gitignore files whitelist any committed defaults.
.env*
+!.env.saas.example
# VS Code
/.vscode/**/*
diff --git a/.taskfiles/backend.yml b/.taskfiles/backend.yml
index 56db8eb4ac..ccf3a77753 100644
--- a/.taskfiles/backend.yml
+++ b/.taskfiles/backend.yml
@@ -39,6 +39,25 @@ tasks:
- cmd: ./gradlew clean bootRun -PbuildWithFrontend=true
platforms: [linux, darwin]
+ dev:saas:
+ desc: "Start backend in SaaS flavor against Supabase (loads .env.saas.local)"
+ # `dotenv:` reads from the root Taskfile's directory (".") because this
+ # subtaskfile is included with `dir: .`. Drop the file at the repo root.
+ dotenv: ['.env.saas.local']
+ ignore_error: true
+ vars:
+ PORT: '{{.PORT | default "8080"}}'
+ # Override to "" to run the pure `saas` profile against your own SAAS_DB_*.
+ PROFILES: '{{.PROFILES | default "dev"}}'
+ env:
+ SERVER_PORT: '{{.PORT}}'
+ STIRLING_FLAVOR: saas
+ cmds:
+ - cmd: cmd /c ".\gradlew.bat :stirling-pdf:bootRun {{if .PROFILES}}--args=\"--spring.profiles.include={{.PROFILES}}\"{{end}}"
+ platforms: [windows]
+ - cmd: ./gradlew :stirling-pdf:bootRun {{if .PROFILES}}--args='--spring.profiles.include={{.PROFILES}}'{{end}}
+ platforms: [linux, darwin]
+
build:
desc: "Full backend build"
cmds: