Skip to content

Commit

Permalink
Merge pull request #2 from benguild/main
Browse files Browse the repository at this point in the history
Suggesting using Secrets instead
  • Loading branch information
Sh4yy authored Jun 15, 2023
2 parents fe6626e + 26aa4bc commit daa1faf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

1. Clone this repository
2. Install the dependencies with `npm install`
3. Add a random `TOKEN` to the `wrangler.toml` file (this will be used to authenticate your requests)
3. Use the command `npx wrangler secret put --env production TOKEN` to deploy a securely stored token to Cloudflare. With this command, you will be prompted to enter a random secret value, which will be used to authenticate your requests with the HTTP `Authorization` header as described below. You can also set this encrypted value directly in your Cloudflare dashboard.
4. Deploy the worker with `npm run deploy`

Or deploy directly to cloudflare
Expand All @@ -33,7 +33,7 @@ This step is optional, but highly recommended. DKIM is a DNS record that helps p

Once you have deployed this worker function to Cloudflare Workers, you can send emails by making a `POST` request to the worker on the `/api/email` endpoint with the following parameters:

- Note you need to pass an `Authorization` header with the `TOKEN` you set in the `wrangler.toml` file. Like the following: `Authorization: TOKEN`
- Note you need to pass an `Authorization` header with the secure token you deployed. Like the following: `Authorization: TOKEN`

### Basic Email

Expand Down
5 changes: 2 additions & 3 deletions wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ name = "worker-email"
main = "src/main.ts"
compatibility_date = "2023-05-18"

#[env.production]
#[env.production.vars]
#TOKEN = "production_value"
[env.production]

0 comments on commit daa1faf

Please sign in to comment.