Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

preview/dev namespaces #1357

Merged
merged 20 commits into from
Jun 10, 2020
Merged

Conversation

EverlastingBugstopper
Copy link
Contributor

@EverlastingBugstopper EverlastingBugstopper commented Jun 2, 2020

fixes #1032

adds preview_id field to items in kv_namespaces that must be provided in order to preview a worker that has kv namespaces. this will prevent folks from accidentally screwing up their production data when using wrangler dev.

also adds --preview to kv commands in order to interact with them instead of production namespaces.

if preview_id and id are same:

$ wrangler preview
💁  JavaScript project found. Skipping unnecessary build!
⚠️  Specifying the same KV namespace ID for both preview and production sessions may cause bugs in your production worker! Proceed with caution.
👷  Your Worker responded with: key: production value

if no preview_id is specified

$ wrangler preview
💁  JavaScript project found. Skipping unnecessary build!
Error: In order to preview a worker with KV namespaces, you must designate a preview_id for each KV namespace you'd like to preview.

if preview_id and id are different:

$ wrangler preview
💁  JavaScript project found. Skipping unnecessary build!
👷  Your Worker responded with: key: preview value

@EverlastingBugstopper EverlastingBugstopper requested a review from a team as a code owner June 2, 2020 20:22
@EverlastingBugstopper EverlastingBugstopper marked this pull request as draft June 2, 2020 20:22
@EverlastingBugstopper EverlastingBugstopper force-pushed the avery/sneaky-snakey-preview branch 2 times, most recently from 80ddc7e to b04f349 Compare June 2, 2020 21:37
@EverlastingBugstopper EverlastingBugstopper marked this pull request as ready for review June 2, 2020 21:49
Copy link
Contributor

@ashleymichal ashleymichal left a comment

Choose a reason for hiding this comment

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

i think this has some lovely ideas; i'd like to see what happens if you pass preview bool to get_target instead of adding a preview_kv_namespaces fn to Target, and retain the plain Vec<KvNamespace> on Target.

src/commands/kv/mod.rs Outdated Show resolved Hide resolved
src/upload/form/mod.rs Outdated Show resolved Hide resolved
src/upload/form/mod.rs Outdated Show resolved Hide resolved
src/upload/mod.rs Outdated Show resolved Hide resolved
src/settings/toml/target.rs Outdated Show resolved Hide resolved
@EverlastingBugstopper EverlastingBugstopper changed the title adds preview_id to namespace manifest definition preview/dev namespaces Jun 3, 2020
Copy link
Contributor

@ashleymichal ashleymichal left a comment

Choose a reason for hiding this comment

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

just remove the old comment and 🚀

src/sites/mod.rs Outdated Show resolved Hide resolved
@EverlastingBugstopper EverlastingBugstopper merged commit e1eab01 into master Jun 10, 2020
@ispivey ispivey added this to the 1.10.0 milestone Jun 11, 2020
@EverlastingBugstopper EverlastingBugstopper deleted the avery/sneaky-snakey-preview branch August 3, 2020 17:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[dev] Use preview namespace for regular workers
3 participants