Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(workers): allow enabling logpush on worker uploads #1160

Merged
merged 2 commits into from
Jan 2, 2023
Merged

feat(workers): allow enabling logpush on worker uploads #1160

merged 2 commits into from
Jan 2, 2023

Conversation

ndisidore
Copy link
Contributor

This allows cloudflare-go users to turn on/off logpush support for Cloudflare Workers.
The analogous functionality in Wrangler can be found here: https://github.com/cloudflare/wrangler2/blob/7169142171b1c9b4ff2f19b8b46871932ef7d10a/packages/wrangler/src/create-worker-upload-form.ts#L294

Description

This adds a new option to CreateWorkerParams that allows control over the logpush setting. Note its a nullable bool: the 3 states are true - on / false - off / nil - unchanged. Again, this is analogous to wrangler with its boolean | undefined type.

Has your change been tested?

A new test was created to test this.

Screenshots (if appropriate):

Types of changes

What sort of change does your code introduce/modify?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • This change is using publicly documented (api.cloudflare.com or developers.cloudflare.com) and stable APIs.

@ndisidore
Copy link
Contributor Author

Re: My code follows the code style of this project. - it looks like there are a number of lint errors present, but none that this change set has introduced

cloudflare-go on  nathan/feat/workers-logpush via 🐹 v1.19.4
❯ golangci-lint --new-from-rev=HEAD~1 run ./..

@github-actions
Copy link
Contributor

github-actions bot commented Dec 29, 2022

changelog detected ✅

@codecov-commenter
Copy link

codecov-commenter commented Dec 29, 2022

Codecov Report

Merging #1160 (6ba86da) into master (6153c1e) will decrease coverage by 0.06%.
The diff coverage is 51.65%.

@@            Coverage Diff             @@
##           master    #1160      +/-   ##
==========================================
- Coverage   49.40%   49.33%   -0.07%     
==========================================
  Files         127      128       +1     
  Lines       12290    12408     +118     
==========================================
+ Hits         6072     6122      +50     
- Misses       4840     4885      +45     
- Partials     1378     1401      +23     
Impacted Files Coverage Δ
utils.go 72.72% <ø> (ø)
mtls_certificates.go 26.59% <26.59%> (ø)
dns.go 68.69% <92.45%> (+4.97%) ⬆️
workers.go 57.62% <100.00%> (+0.48%) ⬆️
email_routing_rules.go 65.64% <0.00%> (+0.26%) ⬆️
teams_list.go 53.01% <0.00%> (+0.28%) ⬆️
queue.go 72.02% <0.00%> (+0.29%) ⬆️
workers_kv.go 39.68% <0.00%> (+0.32%) ⬆️
firewall_rules.go 54.38% <0.00%> (+0.40%) ⬆️
email_routing_destination.go 66.66% <0.00%> (+0.41%) ⬆️
... and 2 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

workers_test.go Outdated
Comment on lines 845 to 846
logpush := true
res, err := client.UploadWorker(context.Background(), AccountIdentifier(testAccountID), CreateWorkerParams{ScriptName: "foo", Script: workerScript, Logpush: &logpush})
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
logpush := true
res, err := client.UploadWorker(context.Background(), AccountIdentifier(testAccountID), CreateWorkerParams{ScriptName: "foo", Script: workerScript, Logpush: &logpush})
res, err := client.UploadWorker(context.Background(), AccountIdentifier(testAccountID), CreateWorkerParams{ScriptName: "foo", Script: workerScript, Logpush: BoolPtr(true)})

we have BoolPtr helper to simlify this sort of usage.

@jacobbednarz jacobbednarz merged commit c15e13e into cloudflare:master Jan 2, 2023
@github-actions github-actions bot added this to the v0.58.0 milestone Jan 2, 2023
github-actions bot pushed a commit that referenced this pull request Jan 2, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2023

This functionality has been released in v0.58.0.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

ivan-section-io pushed a commit to section/cloudflare-go that referenced this pull request Jan 12, 2023
@hmoffatt hmoffatt mentioned this pull request May 23, 2023
2 tasks
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.

4 participants