Skip to content

Support settings export in new config#14724

Open
jamesopstad wants to merge 1 commit into
mainfrom
james/new-config-settings
Open

Support settings export in new config#14724
jamesopstad wants to merge 1 commit into
mainfrom
james/new-config-settings

Conversation

@jamesopstad

Copy link
Copy Markdown
Contributor

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: experimental feature

A picture of a cute animal (not mandatory, but encouraged)

@changeset-bot

changeset-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3b5ac0f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@cloudflare/config Minor
@cloudflare/vite-plugin Minor
wrangler Minor
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ask-bonk

ask-bonk Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

UnknownError: ProviderInitError

github run

@ask-bonk

ask-bonk Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@jamesopstad Bonk workflow failed. Check the logs for details.

View workflow run · To retry, trigger Bonk again.

@github-actions

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@pkg-pr-new

pkg-pr-new Bot commented Jul 16, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@14724

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@14724

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@14724

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14724

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@14724

miniflare

npm i https://pkg.pr.new/miniflare@14724

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@14724

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@14724

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@14724

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@14724

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14724

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@14724

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14724

wrangler

npm i https://pkg.pr.new/wrangler@14724

commit: 3b5ac0f

@jamesopstad
jamesopstad force-pushed the james/new-config-settings branch from a3ab1f2 to 793788c Compare July 17, 2026 10:26
@jamesopstad
jamesopstad force-pushed the james/new-config-settings branch from 793788c to 3b5ac0f Compare July 17, 2026 13:21
@jamesopstad
jamesopstad marked this pull request as ready for review July 17, 2026 13:53
@workers-devprod
workers-devprod requested review from a team and penalosa and removed request for a team July 17, 2026 13:54
@workers-devprod

workers-devprod commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

Comment on lines +433 to +436
* Specify the compliance region mode of the Worker.
*
* Although if the user does not specify a compliance region, the default is `public`,
* it can be set to `undefined` in configuration to delegate to the CLOUDFLARE_COMPLIANCE_REGION environment variable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is this comment saying? Surely not present and undefined are the same?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Never mind, I see it's copied from somewhere

* Authored as a named `settings` export.
*/
export function defineSettings(config: ConfigInput<SettingsConfigInput>) {
return { [DEFINITION]: { config, type: "settings" } };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: why does this need to be so complicated? Surely it can just be:

return { type: "settings", ...config };

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.

It's because config can be a function or promise etc. so type can't be merged onto it until it's resolved. We're also jumping through a few hoops to support authoring config both with the define* helpers and without. Might be worth revisiting at some point if we definitely need to do that.

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Approved

Development

Successfully merging this pull request may close these issues.

3 participants