Environment Config
Environment Config
Section titled “Environment Config”This page consolidates config for local and production Bookmarks deployments.
Worker: workers/bookmarks/api
Section titled “Worker: workers/bookmarks/api”Required bindings
Section titled “Required bindings”DB(D1): Bookmarks database (bookmarks)AUTH_SERVICE(service binding):cosmos-auth-worker(current) orbookmarks-auth-worker(target)DISCUSSION_ROOM(Durable Object): realtime room classBOOKMARKS_MEDIA(R2): media bucket (bookmarks-media)
Required variables
Section titled “Required variables”| Variable | Local default | Production |
|---|---|---|
AUTH_MODE | dev | service |
APP_URL | https://bookmarksapp.cosmosdigitalservices.com | https://bookmarksapp.cosmosdigitalservices.com |
CORS_ORIGINS | includes localhost + app URL | includes deployed app URL(s) |
Notes:
AUTH_MODE=devenables local/dev auth behavior.AUTH_MODE=serviceexpects first-party auth viaAUTH_SERVICE.APP_URLis used for auth verification redirects (/v1/auth/verify->${APP_URL}/verify-email).- Keep
CORS_ORIGINSaligned with deployed app origins.
Flutter app: apps/bookmarks/app
Section titled “Flutter app: apps/bookmarks/app”Primary runtime define used in local/dev:
API_BASE_URL(for examplehttp://127.0.0.1:8787locally, worker domain in prod)
Marketing site: apps/bookmarks/site
Section titled “Marketing site: apps/bookmarks/site”| Variable | Purpose |
|---|---|
PUBLIC_BOOKMARKS_APP_URL | URL used by /auth/open-app redirect to app shell |
PUBLIC_APP_LOGIN_URL | Optional override for login CTA target |
Notes:
- Canonical app URL is
https://bookmarksapp.cosmosdigitalservices.com. - Site now normalizes legacy
app.bookmarks.cosmosdigitalservices.comto canonical host at runtime. - Continue setting canonical env values and redeploying when env changes.
Auth worker prerequisites
Section titled “Auth worker prerequisites”The API worker relies on an auth worker (cosmos-auth-worker current, bookmarks-auth-worker target) being correctly configured.
Minimum expected production configuration:
APP_URLpoints to deployed Bookmarks app URL.MAIL_SERVICEbinding is healthy for verification/reset emails.JWT_SECRETconfigured.ENCRYPTION_KEYconfigured.
Recommended dedicated Bookmarks mail dependency:
MAIL_SERVICE->bookmarks-mail-worker(instead of sharedcosmos-mail-worker)
Quick validation checklist
Section titled “Quick validation checklist”GET /healthreturnsok: truefrom bookmarks API worker.- Login/register/refresh proxies succeed.
- Authenticated
/v1/mereturns user context. - Club stream websocket connects for a club member.