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

wip: add an endpoint for writing configuration data #258

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

philbooth
Copy link
Contributor

Related to #185.

Adds an endpoint that can write (or merge) config data to Redis. There's quite a lot here for a single reviewer, hence opening as WIP and I'll pull out some smaller chunks that can be reviewed independently over the next couple of days.

Copy link
Contributor

@vbudhram vbudhram left a comment

Choose a reason for hiding this comment

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

@philbooth First pass, just a couple comments.

#[derive(Debug, Deserialize)]
struct Payload {
/// Flag indicating whether this payload clobbers existing config or should be merged with it.
clobber: Option<bool>,
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be a little clearer if it was called replace and noted that default is to merge configs.

fn handler(
payload: AppResult<Payload>,
config_db: State<ConfigDb>,
// TODO: do we need the logger?
Copy link
Contributor

Choose a reason for hiding this comment

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

If it isn't too hard, I think it might be useful.

.header(ContentType::JSON)
.body(
r#"{
"clobber": true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these values documented somewhere?

"queue": "https://sqs.us-east-1.amazonaws.com/1234567890/blee",
"rules": [
{ "percentage": 50, "precedence": -127, "provider": "sendgrid" },
{ "percentage": 100, "precedence": 0, "provider": "socketlabs", "regex": "^socketlabs@mozilla\\.com$" },
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the highest precedence be 0? It does seem strange that the highest precedence would be negative in this case.

}

#[test]
fn request_without_optional_fields() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can add more tests for clobber.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants