Cloudflare Worker for uploading images to Amazon S3
MIT License
Cloudflare Worker for uploading images to Amazon S3.
First, git clone:
$ https://github.com/yusukebe/cf-s3-uploader.git
$ cd cf-s3-uploader
Copy wrangler.exmple.toml
to wrangler.tmol
:
$ cp wrangler.example.toml wrangler.toml
Enviroment variables are:
S3_BUCKET
- Your S3 bucket nameS3_REGION
- S3 region nameTo set these, wrangler.toml
[vars]
S3_BUCKET = "your_bucket_name"
S3_REGION = "s3_region_name"
Secret variables are:
NAME
- User name of basic authPASS
- User password of basic authAWS_ID
- AWS access key IDAWS_SECRET
- AWS secret access keyTo set these, use wrangler secret put
command:
$ wrangler secret put NAME
To publish to your Cloudflare Workers:
$ wrangler publish
/upload
Header:
To pass the Basic Auth, add the Base64 string of "user:pass" to Authorization
header.
Authorization: Basic ...
Body:
Value of body
is Basic64 string of image binary.
{
"body": "Base64 Text..."
}
Awesome!!!
Setting shortcuts like this:
Yusuke Wada https://github.com/yusukebe
MIT