-
Notifications
You must be signed in to change notification settings - Fork 5
wip: add an endpoint for writing configuration data #258
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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>, |
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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$" }, |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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.
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.