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

wip: add an endpoint for writing configuration data#258

Open
philbooth wants to merge 1 commit into
masterfrom
pb/185
Open

wip: add an endpoint for writing configuration data#258
philbooth wants to merge 1 commit into
masterfrom
pb/185

Conversation

@philbooth
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread src/api/config/mod.rs
#[derive(Debug, Deserialize)]
struct Payload {
/// Flag indicating whether this payload clobbers existing config or should be merged with it.
clobber: Option<bool>,
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.

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

Comment thread src/api/config/mod.rs
fn handler(
payload: AppResult<Payload>,
config_db: State<ConfigDb>,
// TODO: do we need the logger?
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.

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

Comment thread src/api/config/test.rs
.header(ContentType::JSON)
.body(
r#"{
"clobber": true,
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.

Are these values documented somewhere?

Comment thread src/api/config/test.rs
"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
Copy Markdown
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.

Comment thread src/api/config/test.rs
}

#[test]
fn request_without_optional_fields() {
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.

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