Skip to content

Commit 20d7340

Browse files
committed
docs: update README to document CORS update hook and 3-tier hierarchy
1 parent e310889 commit 20d7340

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

  • graphile/graphile-bucket-provisioner-plugin

graphile/graphile-bucket-provisioner-plugin/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ PostGraphile v5 plugin that automatically provisions S3-compatible buckets when
1717
## Features
1818

1919
- **Auto-provisioning hook** — Wraps `create*` mutations on tables tagged with `@storageBuckets` to automatically provision S3 buckets after row creation
20+
- **CORS update hook** — Wraps `update*` mutations to detect `allowed_origins` changes and re-apply CORS rules to the S3 bucket
21+
- **3-tier CORS resolution** — Bucket-level `allowed_origins` → storage module-level `allowed_origins` → plugin config `allowedOrigins`
22+
- **Wildcard CORS** — Set `allowed_origins = ['*']` on a bucket for fully open CDN/public deployments
2023
- **Explicit `provisionBucket` mutation** — GraphQL mutation for manual/retry provisioning of any bucket
21-
- **Per-database overrides** — Reads `endpoint`, `provider`, and `public_url_prefix` from the `storage_module` table for multi-tenant setups
24+
- **Per-database overrides** — Reads `endpoint`, `provider`, `public_url_prefix`, and `allowed_origins` from the `storage_module` table for multi-tenant setups
2225
- **Lazy S3 config** — Connection config can be a function (evaluated once, cached) to avoid eager env-var reads at import time
23-
- **Graceful error handling** — Provisioning failures are logged but never fail the mutation (admin can retry via `provisionBucket`)
26+
- **Graceful error handling** — Provisioning and CORS update failures are logged but never fail the mutation (admin can retry via `provisionBucket`)
2427
- **Custom bucket naming** — Supports prefix-based naming or a fully custom `resolveBucketName` function
2528

2629
## Installation
@@ -146,7 +149,7 @@ The plugin detects tables tagged with `@storageBuckets` (set by the storage modu
146149
COMMENT ON TABLE app_public.buckets IS E'@storageBuckets\nStorage buckets table';
147150
```
148151

149-
Only `create*` mutations on tagged tables trigger auto-provisioning. Update and delete mutations are not wrapped.
152+
The plugin wraps `create*` mutations for auto-provisioning and `update*` mutations for CORS change detection. Delete mutations are not wrapped.
150153

151154
## Error Handling
152155

0 commit comments

Comments
 (0)