Update setup guide in README, fix first run spam#10
Conversation
WalshyDev
left a comment
There was a problem hiding this comment.
(Sorry for the delay)
This looks good, left a suggestion for how to handle the first run better
| 4b. (optional) If you want publishing, you'll also need to add a Discord bot token with `wrangler secret put DISCORD_TOKEN` | ||
| 5. Run `npm run publish` :) | ||
| 2. Edit `src/config.ts` to set the status URL, name of the webhook, avatar and publish channel | ||
| 3. Authenticate Wrangler with `npx wrangler login`, or set the `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN` environment variables (or put them in `.env`) |
There was a problem hiding this comment.
.env works but i don't think we even document it. .dev.vars is the recommended way
| 3. Authenticate Wrangler with `npx wrangler login`, or set the `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN` environment variables (or put them in `.env`) | |
| 3. Authenticate Wrangler with `npx wrangler login`, or set the `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN` environment variables (or put them in `.dev.vars`) |
There was a problem hiding this comment.
🤔 Are those env values read from .dev.vars? I thought .dev.vars was used for runtime secrets?
There was a problem hiding this comment.
https://developers.cloudflare.com/workers/wrangler/system-environment-variables/ specifically calls out that you can use a .env file
| // On the first run, ignore any incidents that are already resolved | ||
| // We'll store them as skipped so we don't keep checking them | ||
| if (firstRun && incident.status === 'resolved') { | ||
| await env.KV.put(incident.id, JSON.stringify({ skipped: true })); |
There was a problem hiding this comment.
Wonder if we should just set a null value and use metadata instead. Not super opinionated on this though
There was a problem hiding this comment.
With #13 lurking I figured sticking to actual stored data was better?
Co-authored-by: Daniel Walsh <walshydev@gmail.com>
Co-authored-by: Daniel Walsh <walshydev@gmail.com>
👋 This PR does a few small updates as I went about getting this running myself:
Requestwere undefined types), and adds wrangler as a dev dependency so it isn't reliant on a system-wide wrangler installation