This is a CloudFlare Worker that allows you to host your own private Composer repository directly from a CloudFlare R2 Storage bucket, without the need to run any servers. Authentication is done using usernames and passwords stored in CloudFlare KV.
Check full documentation here: opensource.duma.sh/systems/serverless-satis/cloudflare-worker
To deploy this worker, you need to clone repository, update wrangler.toml
configuration file and run wrangler deploy
command.
You need to update wrangler.toml
file with your own values:
Variable Name | Description |
---|---|
name |
Name of your CloudFlare Worker |
vars.PUBLIC_ACCESS_TO_INDEX |
If true, index page will be accessible without authentication |
vars.PUBLIC_ACCESS_TO_JSON |
If true, JSON indexes will be accessible without authentication |
vars.CHECK_FILE_RESTRICTIONS |
See Selective Access |
vars.CHECK_EXTRA_JSON_RESTRICTIONS |
See Selective Access |
vars.STORE_PASSWORDS_HASHED |
See Authentication |
vars.ENABLE_USER_ENDPOINT |
See User Endpoint |
routes.pattern |
Domain you want to expose your private repository on (need to use CloudFlare DNS) |
kv_namespaces.id |
Namespace ID of your Worker KV to read users from |
r2_buckets.bucket_name |
Name of private bucket where are stored files generated by s3-satis tool |
name = "<name>"
main = "src/index.ts"
compatibility_date = "2023-12-06"
[vars]
PUBLIC_ACCESS_TO_INDEX = false
PUBLIC_ACCESS_TO_JSON = false
CHECK_FILE_RESTRICTIONS = false
CHECK_EXTRA_JSON_RESTRICTIONS = false
STORE_PASSWORDS_HASHED = false
ENABLE_USER_ENDPOINT = false
[[routes]]
pattern = "<domain>"
custom_domain = true
[[kv_namespaces]]
binding = "AUTH"
id = "<kv_id>"
[[r2_buckets]]
binding = "R2_BUCKET"
bucket_name = "<bucket_name>"