# Environment variables
Every environment variable the API, the website, the wiki and the tools read — who reads it and what it changes — generated from the code that reads it.
- Page:
- Updated: 2026-11-22
- From the Sri Guru Granth Sahib Ji — Knowledge Base wiki. Sri Guru Granth Sahib Ji is quoted verbatim, cited by Ang, and never altered.
---
59 variables, found by scanning the code for the places that read them. Each row names the
files that read the variable and what it changes; the descriptions are kept beside this page in
`docs/reference/environment.descriptions.json`. Names only: where a variable holds a token or a secret,
its value lives in the GitHub environment or the hosting project, never in the repository
([environments](https://docs.gurbanisoul.com/process/environments/)). Variables the CI runner sets for itself (`CI`,
`GITHUB_OUTPUT`, `GITHUB_REPOSITORY`) are not listed.
## The API and its services
Read by the API process (`webapp/serve.py`) and the services beside it at start-up.
| Variable | Read by | What it changes |
|---|---|---|
| `HUKAMNAMA_ALERT_NTFY_URL` | `services/hukamnama/hukamnama/alerts.py` | `https://ntfy.sh/` (or a self-hosted ntfy server): the Hukamnama service posts every new alert there at once, so it reaches the owner's phone; the dead-man check reads the same value as a repository secret. The topic is the secret (16–64 letters, digits, - or _). Unset: no phone alerts; malformed: the service refuses to start. |
| `HUKAMNAMA_API` | `webapp/hukamnama_page.py` | The origin of the public Hukamnama API (`https://api.gurbanisoul.com`) the web server reads each day's record from to fill the Hukamnama pages, feeds, sitemap and embed. Unset (the default), or without a page shell for the language, the pages are not served. On Vercel the `all` function sets it per environment from `hukamnama_api` in `gateway/routes.json`; a value set on the project wins, and an empty one turns the pages off. Must be `https://…` (or a local `http://127.0.0.1:` / `http://localhost:` address). |
| `HUKAMNAMA_APNS_KEY_FILE` | `services/hukamnama/hukamnama/__main__.py` | Path to the APNs Auth Key (`.p8`, PEM) the Hukamnama service signs its provider token with, as a Render secret file (`/etc/secrets/…`); needed only when `HUKAMNAMA_SEND=on`. The key itself never goes in an environment variable or the repository. |
| `HUKAMNAMA_APNS_KEY_ID` | `services/hukamnama/hukamnama/__main__.py` | The 10-character Key ID of that APNs Auth Key (Apple Developer → Keys); the `kid` of the provider token. |
| `HUKAMNAMA_APNS_TEAM_ID` | `services/hukamnama/hukamnama/__main__.py` | The Apple Developer Team ID that owns the APNs key; the `iss` of the provider token. |
| `HUKAMNAMA_APNS_TOPIC` | `services/hukamnama/hukamnama/__main__.py` | The APNs topic (the app's bundle id); default `org.sggs.app`. |
| `HUKAMNAMA_APPROVE_BASE_URL` | `services/hukamnama/hukamnama/alerts.py` | The https origin the phone alert's Approve and Review buttons call (this service's own Render URL, not the edge). Default: Render's `RENDER_EXTERNAL_URL`. Must be `https://…`. |
| `HUKAMNAMA_APPROVE_SECRET` | `services/hukamnama/hukamnama/alerts.py`, `services/hukamnama/hukamnama/api.py` | Turns on one-tap approve from the phone alert: a `held_veto` alert then carries an Approve button (and a Review page) for the exact run hs.sgpc.net resolved to, signed with this secret (HMAC). The service re-proves the range against the corpus before publishing. Unset (the default): no buttons, and `/owner/approve` answers 404. A long random value set only in Render's environment; never committed, never sent in an alert. |
| `HUKAMNAMA_ARCHIVE` | `services/hukamnama/hukamnama/__main__.py` | Where the Hukamnama service keeps every distinct page it fetched from SGPC, gzip under each Amritsar date with an index of every fetch, kept 60 days (unset: no archive); the same as `serve --archive`. The image sets `/var/data/archive`. |
| `HUKAMNAMA_COMMIT` | `services/hukamnama/hukamnama/api.py` | The source commit the Hukamnama service reports on `/health` so a deploy is verified by identity; the image bakes it from Render's `RENDER_GIT_COMMIT` (falls back to that, then `unknown`). |
| `HUKAMNAMA_DB` | `services/hukamnama/hukamnama/__main__.py` | The scripture database the Hukamnama service reads (default `db/sggs.sqlite`); the same as its `--db` option. |
| `HUKAMNAMA_ENV` | `services/hukamnama/hukamnama/alerts.py` | `staging` (the default) or `production`: the environment name the Hukamnama service puts in its phone alerts' titles. |
| `HUKAMNAMA_MEANING` | `services/hukamnama/hukamnama/__main__.py` | `on` adds the English translation (Dr. Sant Singh Khalsa) to the Hukamnama service's public snapshot as a separate, labelled layer (`lines[].en` and `translation`); anything else (the default) leaves it out, and switching it off removes it from the files on the next sync. The Gurmukhi is identical either way. |
| `HUKAMNAMA_ORIGIN_REQUIRED` | `services/hukamnama/hukamnama/api.py` | `on` makes the Hukamnama service answer `403` on `/v1/*` to any request without the edge's secret (`/health` stays open). Anything else (the default) leaves direct calls allowed. Needs `HUKAMNAMA_ORIGIN_SECRET`. |
| `HUKAMNAMA_ORIGIN_SECRET` | `services/hukamnama/hukamnama/api.py` | The secret the edge Worker sends in `X-Origin-Auth`. When set, the Hukamnama service believes a request's client address (`X-Client-IP`) only with it, and limits every other request by its socket's own address. Set the same value on the Worker (`ORIGIN_SECRET`). Never committed. |
| `HUKAMNAMA_PEER_URL` | `services/hukamnama/hukamnama/peer.py` | The other Hukamnama service's own https origin (production's on staging, staging's on production). The service then checks the other's `/health` every 5 minutes, 05:15–14:15 IST, and raises `peer_down` on its own phone alerts when the other is unreachable, reports `ok=false` or its poller has stopped, after 3 failed checks in a row and once a day. Unset: no watch. Not `https://`: the service refuses to start. |
| `HUKAMNAMA_PUBLIC_ACCESS_KEY_ID` | `services/hukamnama/hukamnama/r2.py` | The access key id of an R2 API token scoped to the public snapshot bucket only (Object Read & Write). Not the backup's token. |
| `HUKAMNAMA_PUBLIC_BUCKET` | `services/hukamnama/hukamnama/r2.py` | The R2 bucket the Hukamnama service writes its public snapshot to, for the edge Worker to serve (unset: no bucket). Needs `HUKAMNAMA_R2_ENDPOINT` and the two `HUKAMNAMA_PUBLIC_…` keys; with any of them missing the service refuses to start. |
| `HUKAMNAMA_PUBLIC_DIR` | `services/hukamnama/hukamnama/__main__.py` | Where the Hukamnama service writes its public snapshot: one file per published day plus an index, rewritten when a day is published, corrected or held (unset: no snapshot); the same as `serve --public-dir`. |
| `HUKAMNAMA_PUBLIC_SECRET_ACCESS_KEY` | `services/hukamnama/hukamnama/r2.py` | The secret of that R2 API token. Set only in the host's environment (Render); never in the repository or a log. |
| `HUKAMNAMA_SEND` | `services/hukamnama/hukamnama/__main__.py` | `on` makes the Hukamnama service push each published Hukamnama to registered devices through APNs; anything else (the default) keeps sending off. With `on` and no usable APNs key the service refuses to start. |
| `HUKAMNAMA_STATE` | `services/hukamnama/hukamnama/__main__.py` | The Hukamnama service's own state database: each day's fetched Hukamnama, the gate's decision and the audit trail (default `hukamnama-state.sqlite`); the same as its `--state` option. |
| `HUKAMNAMA_VERCEL_PROJECT` | `services/hukamnama/hukamnama/purge.py` | The id or name of the Vercel project whose CDN copy of the Hukamnama pages the service purges (see `HUKAMNAMA_VERCEL_PURGE_TOKEN`). |
| `HUKAMNAMA_VERCEL_PURGE_TOKEN` | `services/hukamnama/hukamnama/purge.py` | A Vercel access token for the web project's team, used only to delete the `hukamnama` cache tag from the CDN after a published Hukamnama day is corrected or withdrawn. Set only in the host's environment (Render); never in the repo. With `HUKAMNAMA_VERCEL_PROJECT` and `HUKAMNAMA_VERCEL_TEAM`; with any of the three missing the service refuses to start (all unset: no purge). |
| `HUKAMNAMA_VERCEL_TARGET` | `services/hukamnama/hukamnama/purge.py` | Which of the project's environments the CDN purge clears: `production` or `preview` (unset: Vercel's default). |
| `HUKAMNAMA_VERCEL_TEAM` | `services/hukamnama/hukamnama/purge.py` | The Vercel team id of that project (see `HUKAMNAMA_VERCEL_PURGE_TOKEN`). |
| `LITESTREAM_SHA256` | `services/hukamnama/fetch_litestream.py` | Build-time only, from the Hukamnama Dockerfile's build arg: the sha256 of that Litestream release archive, copied from the release's `checksums.txt`; the image build fails on a mismatch. |
| `LITESTREAM_VERSION` | `services/hukamnama/fetch_litestream.py` | Build-time only, from the Hukamnama Dockerfile's build arg: the Litestream release the image installs for the state backup to R2. Bumped together with `LITESTREAM_SHA256`. |
| `PORT` | `services/hukamnama/hukamnama/__main__.py`, `webapp/serve.py` | The port to listen on, set by the host (Render, a container platform). The API prefers it to `SGGS_PORT`; the Hukamnama service defaults to 8080 without it. |
| `RENDER_EXTERNAL_URL` | `services/hukamnama/hukamnama/alerts.py` | Set by Render to the service's own `https://.onrender.com` URL; the Hukamnama service uses it as the default approve-button origin (`HUKAMNAMA_APPROVE_BASE_URL`). |
| `RENDER_GIT_COMMIT` | `services/hukamnama/hukamnama/api.py`, `webapp/serve.py` | Injected by Render: the commit being served, reported by `/api/health` → `commit` so a deploy is verified by identity. |
| `SGGS_ACCESS_LOG` | `webapp/serve.py` | `0` turns off the one-line JSON access log written per request (default on); the generators that drive the API in-process set it. |
| `SGGS_COMMIT` | `webapp/serve.py` | The source commit `/api/health` reports when the host does not inject `RENDER_GIT_COMMIT`; the generated API functions set it at deploy time. |
| `SGGS_DB` | `webapp/sggs/core.py` | The database file the API opens read-only; a per-context function points it at its own slice of the database. Default: `db/sggs.sqlite`. |
| `SGGS_MAX_WORKERS` | `webapp/serve.py` | How many requests the threaded server handles at once before new ones queue (default 48). |
| `SGGS_MODULES` | `webapp/serve.py` | Which bounded contexts this process serves: `all` (the default, the whole API) or a comma list such as `search` or `insights,knowledge`. An unknown name stops the server. |
| `SGGS_OPEN_BROWSER` | `webapp/serve.py` | `1` opens the site in the desktop browser when the server starts; never set on a host. |
| `SGGS_PORT` | `webapp/serve.py` | The API's local port when `PORT` is not set (default 7777), e.g. to run a second server beside another worktree's. |
## The website build
Read by the Astro build of the website. `PUBLIC_` variables are compiled into the pages, so they are switches and public addresses, never secrets.
| Variable | Read by | What it changes |
|---|---|---|
| `PUBLIC_APP_STORE_LIVE` | `frontend/src/site.ts` | `1` once the app is live on the App Store: the pages show the store link, the Smart App Banner and the install URL; otherwise "Coming soon". Set in the production project on launch day. |
| `PUBLIC_CONTRIBUTE_MODE` | `frontend/src/contribute.ts` | Which payment links the Contribute page carries: `live`, `test` (Stripe test mode, for staging) or `off` (the default, no links). A link that does not fit the mode fails the build. |
| `PUBLIC_I18N_PREVIEW` | `frontend/src/i18n/locales.ts` | `all` also builds every drafted language that has a catalog, for a reviewer to read on real pages; never set for production. |
| `PUBLIC_I18N_PSEUDO` | `frontend/src/i18n/t.ts` | `1` builds every catalog string as pseudo-text, so a string that bypasses the catalog, or a layout that cannot take a longer translation, stands out. |
| `PUBLIC_NEWSLETTER_FORM_URL` | `frontend/src/components/Newsletter.astro`, `frontend/src/pages/[lang]/privacy.astro` | The launch-notice sign-up form's address; without it the sign-up band is not built and the privacy page leaves out its section. |
## The wiki build
Read by the wiki's build and its review scripts.
| Variable | Read by | What it changes |
|---|---|---|
| `DOCS_API` | `docs-site/scripts/visual-qa.mjs` | Where the wiki's visual review script sends `/api` requests so live widgets show real data (default: production). |
| `DOCS_PAGE_ACTIONS` | `docs-site/plugins/features.mjs` | `0` builds the wiki without the page menu (copy, view as Markdown, assistant links, print), should it misbehave in production. |
| `DOCS_PDF` | `docs-site/plugins/features.mjs` | `1` also builds a PDF of every page; CI sets it for every build it tests or deploys, a local build is quicker without. |
| `PUBLIC_DOCS_COMMIT` | `docs-site/astro.config.mjs`, `docs-site/plugins/export-pages.mjs`, `docs-site/plugins/remark-code-excerpt.mjs`, `docs-site/scripts/review-pack.mjs`, `docs-site/src/components/Footer.astro` | The commit the wiki documents: it pins code excerpts and repository links, and is shown in the footer and in the `sggs-docs-commit` meta tag the deploy smoke test checks. CI passes it; locally it is read from git. |
| `VERCEL_BYPASS` | `docs-site/scripts/visual-qa.mjs` | The protection-bypass secret the wiki's visual review script sends to reach a protected base URL such as the staging alias. |
## Tools, CI and release scripts
Read by the generators, gates and deploy scripts, locally and in GitHub Actions.
| Variable | Read by | What it changes |
|---|---|---|
| `COUPLING_ENFORCE` | `tools/docs_coupling.py` | Turns the docs-impact check (tools/docs_coupling.py) into a gate: when 1/true/on, a page that declares `covers:` and was neither updated, re-stamped nor named on its own `Docs-impact: docs/.md — ` line fails the run. On in docs-coupling.yml since 2026-11-22; release pull requests and bot branches are reported but never fail. |
| `DOCS_HEALTH_TOKEN` | `tools/docs_check.py` | A GitHub token that can read this repository's pull requests. `docs_check.py --health` reads each merged pull request's description with it (its Docs-impact lines) to measure the coupling debt; falls back to GH_TOKEN/GITHUB_TOKEN, and without any token the debt is labelled an upper bound. |
| `GH_TOKEN` | `scripts/data/fetch_dataset.py`, `scripts/release/check_release_complete.py`, `tools/docs_check.py`, `tools/fetch_sibling_docs.py`, `tools/gen_repo_map.py` | A GitHub token for reading the private sibling repositories and their releases: the dataset download, the pinned sibling docs, the repository-map check, the release-complete check and the sibling pin lag on the docs-health page. Preferred over `GITHUB_TOKEN`. |
| `GITHUB_TOKEN` | `scripts/data/fetch_dataset.py`, `scripts/release/check_release_complete.py`, `tools/docs_check.py`, `tools/fetch_sibling_docs.py`, `tools/gen_repo_map.py` | The fallback GitHub token when `GH_TOKEN` is not set (the token GitHub Actions provides); read by the same scripts. |
| `SGGS_READ_TOKEN` | `tools/fetch_sibling_docs.py` | The third fallback for reading the pinned sibling docs, after `GH_TOKEN` and `GITHUB_TOKEN`; in CI it is the read-only token for the sibling repositories. |
| `VERCEL_AUTOMATION_BYPASS_SECRET` | `scripts/ci/hukamnama_morning.py`, `scripts/ci/verify_functions.py`, `tools/contract_http.py` | Vercel's protection-bypass secret, sent as `x-vercel-protection-bypass` so the contract replay and the function verification can reach a protected staging or preview deployment. |
| `VERCEL_DOCS_BYPASS_SECRET` | `scripts/ci/docs_smoke.py` | The wiki project's protection-bypass secret, sent by the post-deploy smoke test to reach a protected wiki deployment. |
| `VERCEL_ENV` | `tools/build_api_functions.py` | Set by Vercel itself in every deployment (`production`, `preview` or `development`); never set by hand. The generated `all` function reads it to choose the Hukamnama API of the environment it runs in (`hukamnama_api` in `gateway/routes.json`; staging is a preview deployment). |
| `VERCEL_ORG_ID` | `scripts/ci/vercel_api.py` | The Vercel team the API calls of `scripts/ci/vercel_api.py` are made in; required with `VERCEL_TOKEN`. |
| `VERCEL_PROJECT_ID` | `scripts/ci/vercel_api.py` | The Vercel project `scripts/ci/vercel_api.py has-production` asks about. |
| `VERCEL_TOKEN` | `scripts/ci/vercel_api.py` | A Vercel API token for `scripts/ci/vercel_api.py` (which deployment serves a domain, a deployment's target, whether a project has a production deployment). |
## How this page stays true
`tools/gen_env_vars.py --check` runs in the docs job and in `make docs-check`: a new read of a variable
without a description, a description for a variable nothing reads any more, or a page that differs
from the code fails it. To add a variable, read it in the code, add one sentence to the descriptions
file and run `python3 tools/gen_env_vars.py`.