Skip to main content

Environment variables

This page lists names, not values. Secret values live in gitignored .env.*.local files, in the deployment stack, and in files that should not be quoted anywhere.

Where the contract lives​

LayerFileTracked?
Both APIs.env.templateYes — names only. Use it as the checklist.
Both APIs.env.nonprod.localNo — shared dev/test trust domain
Both APIs.env.development.local / .env.test.localNo — endpoint overlay
Both APIs.env.production.localNo — production only, no shared layer
Website.env.test, .env.productionVaries by branch; Vite mode selects one
Webview.env, .env.testStale copies exist; check which Vite loads
Admin web.env*Fallback host applies when VITE_API_BASE_URL is absent
Workerbaked into the imageThe image-baked key is what the boot script validates

APP_ENV is not NODE_ENV. APP_ENV picks the environment contract; NODE_ENV picks build/runtime behaviour. Both are validated at boot.

Every service​

NameRead byNotes
APP_ENVAPIsdev | test | prod. Required for npm start.
NODE_ENVall Node servicesdevelopment | production
PORTAPIs3001 (customer dev), 3000 (customer test/prod), 3003 (admin)
SECRET_KEYAPIsJWT signing. The customer API only warns on a weak value.
FIREBASE_SERVICE_ACCOUNTAPIsPath to a service-account JSON. Missing or unreadable → boot fails.
FIREBASE_DATABASE_URLadmin APIRTDB URL. Required for the claim consumers.
CORS_ORIGIN / ORIGINAPIsAllowlist. Wildcard is rejected in production.
CREDENTIALSAPIsCookie/CORS credentials flag
GCS_IMAGE_BUCKETAPIsMust end in -test or -prod matching APP_ENV
GCS_VIDEO_BUCKETadmin APIRaw masters
VIDEO_OUTPUT_BUCKETadmin APIHLS output
MAX_UPLOAD_SIZE_BYTESadmin APIVideo/trailer limit
MAX_IMAGE_UPLOAD_SIZE_BYTESadmin APIArtwork limit, default 15 MiB
SIGNED_URL_TTL_MSadmin APISigned PUT lifetime

Admin API​

NameNotes
GCE_INSTANCE_NAMEFixed name, gstv-vps-<env>-worker
GCE_INSTANCE_NAME_PREFIXUsed when the fixed name is not set
GCE_INSTANCE_ZONEMust match the template; setup-iam.sh's default zone has differed
GCE_PROJECT_IDProject that owns the VM
GCE_INSTANCE_TEMPLATEPer-environment template
VPS_IDLE_THRESHOLD_MSHow long an idle worker waits before deleting itself
VPS_SHUTDOWN_GRACE_MSShutdown window
VPS_HEARTBEAT_STALE_MSDefault 60 000. A stale heartbeat is normal after a delete.
GCE_MAX_INSTANCE_AGE_MS24-hour hard cap
VM_CHECK_INTERVAL_MSScheduler tick
GCE_PRICE_PER_HOUR, GCE_PRICE_CURRENCYDashboard cost estimate
RESOLUTION_CONSUMER_DISABLEDMust not be true in production. Set on the test stack to avoid a second claim consumer.
UPLOAD_RATE_LIMITDefault 100 per 15-minute window
ADMIN_AUTH_DISABLEDBypasses auth. Production does not reject it.

Unusable VM settings disable auto create/delete rather than retrying — check the boot log if the worker never appears.

Payments​

NameNotes
STRIPE_SECRET_KEYPrefix must match APP_ENV: sk_test_ or sk_live_
STRIPE_WEBHOOK_SECRETRaw-body signature verification
STRIPE_PRICE_BASIC, STRIPE_PRICE_STANDARD, STRIPE_PRICE_PREMIUMPrice IDs carry no mode
STRIPE_SUCCESS_URL, STRIPE_CANCEL_URLMust match the origin that created the session
FLW_*Flutterwave. The production merchant is used in every environment.
FLW_SECRET_HASHChecked against the verif-hash header
TWILLIO_*Twilio (note the spelling — the code uses it)

Frontends​

NameRead byNotes
VITE_API_BASE_URLwebsite, admin web, webviewAdmin web falls back to the legacy host when unset
VITE_API_KEYwebsitePlaceholder values exist in test env files
VITE_MODEwebsite Docker buildSelects .env.${VITE_MODE}; the build refuses without it
VITE_STREAMING_BASE_URLwebviewDefaults to the test origin in development
VITE_STRIPE_PUBLISHABLE_KEYwebsite, webviewPrefix must match the API's key mode
APP_VARIANT / EAS_BUILD_PROFILEphone shell, TVSelects the Firebase key folder and app IDs

Worker​

NameNotes
RTDB_URLPoints at the database whose queues it drains
GSTV_INPUT_VIDEO_FOLDERgcsfuse mount path for masters
GSTV_OUTPUT_VIDEO_FOLDERgcsfuse mount path for HLS output
DEFAULT_SEG_DURATIONHLS segment length
ENABLE_VM_SELF_DELETEFalse outside GCE, or shutdown tries to delete a nonexistent instance
VPS_IDLE_THRESHOLD_MS, VPS_SHUTDOWN_GRACE_MSMust agree with the admin API's view

Not environment-configurable​

  • Artwork dimensions and WebP quality. They live in gstv-admin-api/src/utils/imageArtwork.ts and are mirrored in gstv-admin-web/src/config/artwork.js.
  • The plan → price priority mapping. It is code, not configuration.
  • The HLS ladder. 144p–2160p, filtered by source height.
  • The Firebase project of the website. It is selected by branch, not by env (src/Firebase/FirebaseConfig.js). See Branch strategy.

Next: Endpoints · Branch strategy · Security notes.