-
Notifications
You must be signed in to change notification settings - Fork 207
polish bridge config #925
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
polish bridge config #925
Conversation
ccd3933
to
34dd014
Compare
LGTM |
34dd014
to
4db3f28
Compare
96ab119
to
5dc92fe
Compare
6181249
to
a16bc3d
Compare
@svix-onelson, can you do a "diff" (maybe in a new PR) that's just the result files? As in, just have diffs where new files are added so that we can comment on the syntax easily (like a PR review) with the annoying diff lines. Does this make sense? |
Yeah, I think that's what I did to kick off the conversation. I'll copy the example file to a new file. |
Discussed with @tasn - there are a couple of action items to clear before this moves forward.
So, I guess the idea will be to sketch out these alternate realities and see which feels the most accessible, then after, look at the code changes needed to make them real. I'll post a series of new yaml files to explore these ideas as subsequent revs, then we'll discuss. |
7a65e18
to
935101d
Compare
c43d498
to
5bba7f0
Compare
input: | ||
type: "rabbitmq" | ||
queue: "local" | ||
uri: "amqp://example.com/%2f" | ||
# Optional transformation. JSON bodies will be forwarded as-is when unset. |
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.
Omitted the requeue_on_nack
-- let's assume we can pick a default either way and document what it is, though this feels like a "stopped clock is correct twice a day" situation to me.
# The "webhook" input type uses the HTTP listener. POST bodies/headers are "handled" by forwarding to the | ||
# configured "output." | ||
type: "webhook" |
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.
I prefer "webhook" to "http" since we're biased towards POST requests with JSON objects for bodies. I'd expect an "HTTP" input to have a lot more config options to let me go wild, but "webhook" sort of curbs that feeling for me.
13dec2d
to
2c744af
Compare
So, I'm going to dig in on the supporting refactors to make The biggest change required seems to be
There might be some other things in the HTTP code that needs to change but I'm not sure what that might include right now. The rewrangling of configs to match the examples is probably the smallest lift overall. If there are extra changes in direction for the config part, I'm betting the refactoring of the HTTP stuff will still make sense. It feels right that the binary owns the HTTP server just like it owns the JS Runtime. The doubt I have is that we might want to listen on other protocols in the future, and making the listener "belong to the plugin" would make the most sense for that, but as they say: "you ain't gonna need it" (YAGNI). That's tomorrow's problem. |
@@ -0,0 +1,65 @@ | |||
log_level: "debug" |
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.
Everything looks excellent in this and the senders examples!
One thing I'd make sure that we support in this YAML is loading from env var. Does YAML by any chance have an extension that supports just loading from env vars so I can do? key: $MY_KEY
in the config and then we'll load the key from env var or env var file?
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.
Nothing is provided for this in serde_yaml
from what I saw. We could pre-process the config to expand vars before parsing the YAML using something like shellexpand.
In the past I'd used envsubst, in a shell command but that's a bit clumsy for launching services. My use case was for deployments, etc where you're usually running a series of commands anyway.
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.
No worries, this can be second step. I think shellexpand sounds scary/too much.
Anyhow, if there's something that can do it well we can consider it, but as long as it's very limited with what it does.
6a05701
to
a286318
Compare
This is a pretty large shift. Here's a breakdown of the broad strokes: - The `Plugin` trait was removed from -types. - New traits added: `SenderInput` and `ReceiverOutput` to represent the non-svix portions of the dataflow. - Removed the -webhook-receiver plugin crate. - moved the http server from the `-plugin-webhook-receiver` crate into bridge. - "queue forwarders" into the -plugin-queue-consumer crate. - Renamed the -plugin-queue-consumer crate to just `-plugin-queue` (it now provides both `SenderInput` and `ReceiverOutput` implementations). - Configuration revamp to align with the sender/receiver split.
1d1f31e
to
4b222c1
Compare
Alright y'all. After a bunch of conversations about the overall config and mental model to apply to the project (from the user perspective), this PR ended up _huge_. It'll be a tough review. I'm sorry 😭 This is a pretty large shift. Here's a breakdown of the broad strokes: - The `Plugin` trait was removed from `-types`. - New traits added: `SenderInput` and `ReceiverOutput` to represent the non-svix portions of the dataflow. - Removed the `-plugin-webhook-receiver` plugin crate. - moved the http server from the `-plugin-webhook-receiver` crate into `svix-bridge`. - "queue forwarders" into the `-plugin-queue-consumer` crate. - Renamed the `-plugin-queue-consumer` crate to just `-plugin-queue` (it now provides both `SenderInput` and `ReceiverOutput` implementation for the various queue backends. - all crates etc have been renamed: `s/svix-webhook-bridge/svix-bridge/` What else, what else, what else... The example config has been split into 2: one showing `senders` and another for `receivers`. The readme has been gutted (but probably needs to be fleshed out a bit more... again). It felt silly to effectively duplicate the example configs in code fence blocks a 2nd time. To sweeten the deal, new test coverage has been added for select portions of the config parsing as well as for the HTTP receiver stuff. Both the sender and receiver example configs are now checked in the test suite to make sure they at least parse without failure. These tests should be expanded to inspect the actual data, but this diff is so big... 😭 We didn't have any tests for the HTTP handler execution before this, so that's very nice to have.
Alright y'all. After a bunch of conversations about the overall config and mental model to apply to the project (from the user perspective), this PR ended up _huge_. It'll be a tough review. I'm sorry 😭 This is a pretty large shift. Here's a breakdown of the broad strokes: - The `Plugin` trait was removed from `-types`. - New traits added: `SenderInput` and `ReceiverOutput` to represent the non-svix portions of the dataflow. - Removed the `-plugin-webhook-receiver` plugin crate. - moved the http server from the `-plugin-webhook-receiver` crate into `svix-bridge`. - "queue forwarders" into the `-plugin-queue-consumer` crate. - Renamed the `-plugin-queue-consumer` crate to just `-plugin-queue` (it now provides both `SenderInput` and `ReceiverOutput` implementation for the various queue backends. - all crates etc have been renamed: `s/svix-webhook-bridge/svix-bridge/` What else, what else, what else... The example config has been split into 2: one showing `senders` and another for `receivers`. The readme has been gutted (but probably needs to be fleshed out a bit more... again). It felt silly to effectively duplicate the example configs in code fence blocks a 2nd time. To sweeten the deal, new test coverage has been added for select portions of the config parsing as well as for the HTTP receiver stuff. Both the sender and receiver example configs are now checked in the test suite to make sure they at least parse without failure. These tests should be expanded to inspect the actual data, but this diff is so big... 😭 We didn't have any tests for the HTTP handler execution before this, so that's very nice to have.
Alright y'all. After a bunch of conversations about the overall config and mental model to apply to the project (from the user perspective), this PR ended up huge. It'll be a tough review. I'm sorry 😭
This is a pretty large shift.
Here's a breakdown of the broad strokes:
Plugin
trait was removed from-types
.SenderInput
andReceiverOutput
to represent thenon-svix portions of the dataflow.
-plugin-webhook-receiver
plugin crate.-plugin-webhook-receiver
crate intosvix-bridge
.-plugin-queue-consumer
crate.-plugin-queue-consumer
crate to just-plugin-queue
(itnow provides both
SenderInput
andReceiverOutput
implementation for the various queue backends.s/svix-webhook-bridge/svix-bridge/
What else, what else, what else...
The example config has been split into 2: one showing
senders
and another forreceivers
.The readme has been gutted (but probably needs to be fleshed out a bit more... again). It felt silly to effectively duplicate the example configs in code fence blocks a 2nd time.
To sweeten the deal, new test coverage has been added for select portions of the config parsing as well as for the HTTP receiver stuff.
Both the sender and receiver example configs are now checked in the test suite to make sure they at least parse without failure. These tests should be expanded to inspect the actual data, but this diff is so big... 😭
We didn't have any tests for the HTTP handler execution before this, so that's very nice to have.