update README/environment variables
This commit is contained in:
parent
8b523474da
commit
dcf57cfea9
36
README.md
36
README.md
|
@ -1,9 +1,37 @@
|
|||
Upload worker to CloudFlare
|
||||
===========================
|
||||
|
||||
`zig build run -- <worker name> <script file>`. Make sure that CF_X_AUTH_EMAIL
|
||||
and CF_X_AUTH_KEY environment variables are set with the correct authentication
|
||||
parameters. An example index.js file is included in the root of the project
|
||||
`zig build run -- <worker name> <script file>`. Make sure that authentication
|
||||
environment variables are set. An example index.js file is included in the
|
||||
root of the project
|
||||
|
||||
Environment Variables
|
||||
---------------------
|
||||
|
||||
The following environment variables are supported and match Wrangler behavior:
|
||||
|
||||
|
||||
CLOUDFLARE_ACCOUNT_ID
|
||||
|
||||
The account ID for the Workers related account.
|
||||
|
||||
CLOUDFLARE_API_TOKEN
|
||||
|
||||
The API token for your Cloudflare account, can be used for authentication for situations like CI/CD, and other automation.
|
||||
|
||||
CLOUDFLARE_API_KEY
|
||||
|
||||
The API key for your Cloudflare account, usually used for older authentication method with CLOUDFLARE_EMAIL=.
|
||||
|
||||
CLOUDFLARE_EMAIL
|
||||
|
||||
The email address associated with your Cloudflare account, usually used for older authentication method with CLOUDFLARE_API_KEY=.
|
||||
|
||||
Note that either CLOUDFLARE_API_TOKEN or CLOUDFLARE_EMAIL/CLOUDFLARE_API_KEY
|
||||
environment variable pair are required
|
||||
|
||||
Development notes
|
||||
=================
|
||||
|
||||
Getting new src/script_harness.js
|
||||
---------------------------------
|
||||
|
@ -23,7 +51,7 @@ Getting new memfs.wasm
|
|||
|
||||
Steps we take:
|
||||
--------------
|
||||
0. Get account id. CF_ACCOUNT_ID environment variable will be checked first. If not,
|
||||
0. Get account id. CLOUDFLARE_ACCOUNT_ID environment variable will be checked first. If not,
|
||||
GET https://api.cloudflare.com/client/v4/accounts/
|
||||
1. Check if the worker exists:
|
||||
GET https://api.cloudflare.com/client/v4/accounts/<account id>/workers/services/<worker_name>
|
||||
|
|
|
@ -348,8 +348,8 @@ threadlocal var auth_buf: [1024]u8 = undefined;
|
|||
fn addAuthHeaders(headers: *std.http.Headers) !void {
|
||||
if (!initialized) {
|
||||
x_auth_email = std.os.getenv("CLOUDFLARE_EMAIL");
|
||||
x_auth_key = std.os.getenv("CLOUDFLARE_API_TOKEN");
|
||||
x_auth_token = std.os.getenv("CLOUDFLARE_API_KEY");
|
||||
x_auth_key = std.os.getenv("CLOUDFLARE_API_KEY");
|
||||
x_auth_token = std.os.getenv("CLOUDFLARE_API_TOKEN");
|
||||
initialized = true;
|
||||
}
|
||||
if (x_auth_token) |tok| {
|
||||
|
|
Loading…
Reference in New Issue
Block a user