Skip to content

Commit 76caebb

Browse files
committed
chore(infra): activate ORGANIZATION_LOGOS R2 binding after provisioning
Bucket usrse-organization-logos provisioned on the US-RSE Cloudflare account (same one that hosts usrse-profile-photos), public dev URL enabled at pub-4bc181f2e72740c08c7f842a04b43f3b.r2.dev. Uncomments the binding in wrangler.jsonc, fills in ORGANIZATION_LOGOS_PUBLIC_URL, and refreshes the AppEnv comment to explain why ORGANIZATION_LOGOS stays optional (defense-in-depth for preview/test envs) instead of implying the binding isn't provisioned yet. The admin Branding tab and POST /admin/organizations/:id/logo endpoints will stop returning 503 not_configured the moment the worker deploys.
1 parent 4a7d4a8 commit 76caebb

2 files changed

Lines changed: 13 additions & 23 deletions

File tree

‎packages/api/src/types.ts‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,17 @@ export type Bindings = {
1818
/** Public base URL for profile-photo bucket reads (r2.dev today). */
1919
PROFILE_PHOTOS_PUBLIC_URL: string;
2020
/**
21-
* R2 bucket holding hosted organization logo files. Optional
22-
* because the binding is commented out in wrangler.jsonc until the
23-
* bucket is provisioned in the Cloudflare dashboard — code reading
24-
* this must guard on `env.ORGANIZATION_LOGOS` being defined and
25-
* fall back to the InitialsHex stamp when it isn't.
21+
* R2 bucket holding hosted organization logo files. Stayed optional
22+
* even though the binding is now provisioned — keeps the code
23+
* defensive against preview/test environments that haven't been
24+
* configured yet. Runtime gate is isLogoHostingConfigured() in
25+
* lib/storage-org-logo.ts.
2626
*/
2727
ORGANIZATION_LOGOS?: R2Bucket;
2828
/**
29-
* Public base URL for organization-logo bucket reads. Empty until
30-
* the bucket is provisioned and the URL is filled in via wrangler.
31-
* Code that surfaces logos must treat empty-string as "not yet
32-
* configured" and fall back to InitialsHex.
29+
* Public base URL for organization-logo bucket reads (r2.dev URL,
30+
* surfaced through wrangler.jsonc). Empty-string still means "not
31+
* configured" so the gate logic stays uniform across environments.
3332
*/
3433
ORGANIZATION_LOGOS_PUBLIC_URL: string;
3534
};

‎packages/api/wrangler.jsonc‎

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,15 @@
1717
{
1818
"binding": "PROFILE_PHOTOS",
1919
"bucket_name": "usrse-profile-photos"
20+
},
21+
{
22+
"binding": "ORGANIZATION_LOGOS",
23+
"bucket_name": "usrse-organization-logos"
2024
}
21-
// ORGANIZATION_LOGOS binding is uncommented once the bucket is
22-
// provisioned in the Cloudflare dashboard. Wrangler refuses to
23-
// deploy when a binding points at a bucket that doesn't exist
24-
// (deploy 25594274231 failed this way), so the binding lives
25-
// here as a comment until then. AppEnv.Bindings keeps the type
26-
// so feature code can be written safely in the meantime.
27-
// {
28-
// "binding": "ORGANIZATION_LOGOS",
29-
// "bucket_name": "usrse-organization-logos"
30-
// }
3125
],
3226
"vars": {
3327
"PROFILE_PHOTOS_PUBLIC_URL": "https://pub-12a8fe7ab15d4128be3f4867cc11b99f.r2.dev",
34-
// Set after the bucket is provisioned. Until then, the worker
35-
// shouldn't surface logos to clients — gate writes/reads on a
36-
// non-empty value.
37-
"ORGANIZATION_LOGOS_PUBLIC_URL": ""
28+
"ORGANIZATION_LOGOS_PUBLIC_URL": "https://pub-4bc181f2e72740c08c7f842a04b43f3b.r2.dev"
3829
}
3930
// Environment variables (DATABASE_URL) are injected via:
4031
// - .dev.vars for local `wrangler dev`

0 commit comments

Comments
 (0)