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

Secrets endpoints #91

Merged
merged 4 commits into from
Feb 5, 2020
Merged

Conversation

exvuma
Copy link
Contributor

@exvuma exvuma commented Jan 23, 2020

Addition of the future Workers secret API endpoint

@exvuma exvuma requested a review from ashleymichal January 23, 2020 20:57
cloudflare/src/endpoints/workers/mod.rs Outdated Show resolved Hide resolved
cloudflare/src/endpoints/workers/mod.rs Outdated Show resolved Hide resolved
/// account id of owner of the script
pub account_identifier: &'a str,
/// the name of the script to attach the secret to
pub script_name: &'a str,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm starting to think that these should be owned strings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean by these? @ashleymichal how should we apply this suggestion?

Copy link
Contributor

Choose a reason for hiding this comment

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

Basically turn &'a str into a String

Copy link
Contributor

Choose a reason for hiding this comment

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

we don't do this anywhere else :-\

Copy link
Contributor

@ashleymichal ashleymichal Feb 5, 2020

Choose a reason for hiding this comment

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

@sssilver i actually started turning all of these &'a str's into &'static str's elsewhere in wrangler. saves the requirement for lifetimes on all your structs and their methods. will illustrate in another pr.

cloudflare/src/endpoints/workers/mod.rs Outdated Show resolved Hide resolved
/// the variable name of the secret that will be bound to the script
pub name: String,
/// the string value of the secret
pub value: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

Are secret values strings or bytes? It feels like the latter would be more proper, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

yah bytes is probably better

Copy link
Contributor

Choose a reason for hiding this comment

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

except you can't precisely send a byte string in a json body...

Copy link
Contributor

Choose a reason for hiding this comment

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

You can serialize them as a string, however within the Rust type system it should still be bytes

Copy link
Contributor

Choose a reason for hiding this comment

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

That would force you to think about how that "string" should be deserialized. There isn't a single way to serialize bytes into a string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was giving me a hard time. Since it's not a blocker I filed an issue to prioritize later #98

@exvuma exvuma changed the title Secrets create endpoint Secrets endpoints Jan 27, 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.

This looks good; I'm almost inclined to wait to merge until the api is complete and we can test but otoh this is the contract.

cloudflare/src/endpoints/workers/mod.rs Outdated Show resolved Hide resolved
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.

sorry, spaced on my previous comment in my previous review. please fix spacing in workers/mod.rs

@exvuma exvuma requested a review from ashleymichal January 27, 2020 20:20
@ashleymichal ashleymichal requested a review from sssilver January 27, 2020 21:30
pub account_identifier: &'a str,
/// the name of the script to attach the secret to
pub script_name: &'a str,
/// secert's contents
Copy link
Contributor

Choose a reason for hiding this comment

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

s/secert/secret

Also all our comments elsewhere start with a capital, could you please change yours to be consistent? :)

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.

a couple of things have changed and i will need to amend this PR.

@ashleymichal ashleymichal merged commit 358de27 into cloudflare:master Feb 5, 2020
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