Skip to content

Update setup guide in README, fix first run spam#10

Merged
WalshyDev merged 8 commits into
WalshyDev:mainfrom
MattIPv4:MattIPv4/updates
Apr 5, 2024
Merged

Update setup guide in README, fix first run spam#10
WalshyDev merged 8 commits into
WalshyDev:mainfrom
MattIPv4:MattIPv4/updates

Conversation

@MattIPv4

@MattIPv4 MattIPv4 commented Jan 30, 2023

Copy link
Copy Markdown
Contributor

👋 This PR does a few small updates as I went about getting this running myself:

  • Updates the instructions in the README to cover all the steps needed to run this (closes Tutorial for setup #3)
  • Modifies the logic for posting new incidents slightly, skipping resolved incidents that were never posted, as to avoid spamming old incidents on the first run
  • Updates the types dependency (as things like Request were undefined types), and adds wrangler as a dev dependency so it isn't reliant on a system-wide wrangler installation

Comment thread src/index.ts Outdated

@WalshyDev WalshyDev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Sorry for the delay)

This looks good, left a suggestion for how to handle the first run better

Comment thread src/index.ts Outdated
Comment thread README.md
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`)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.env works but i don't think we even document it. .dev.vars is the recommended way

Suggested change
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`)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Are those env values read from .dev.vars? I thought .dev.vars was used for runtime secrets?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://developers.cloudflare.com/workers/wrangler/system-environment-variables/ specifically calls out that you can use a .env file

Comment thread src/index.ts Outdated
Comment thread src/index.ts Outdated
Comment thread src/index.ts
// 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 }));

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder if we should just set a null value and use metadata instead. Not super opinionated on this though

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With #13 lurking I figured sticking to actual stored data was better?

Comment thread src/index.ts Outdated
MattIPv4 and others added 2 commits December 31, 2023 17:11
Co-authored-by: Daniel Walsh <walshydev@gmail.com>
Co-authored-by: Daniel Walsh <walshydev@gmail.com>
@MattIPv4 MattIPv4 requested a review from WalshyDev December 31, 2023 17:12
Comment thread src/index.ts Outdated
@WalshyDev WalshyDev merged commit 805a108 into WalshyDev:main Apr 5, 2024
@MattIPv4 MattIPv4 deleted the MattIPv4/updates branch April 5, 2024 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tutorial for setup

2 participants