@@ -19,10 +19,12 @@ use tracing::Level;
19
19
#[ derive( Deserialize ) ]
20
20
#[ serde( deny_unknown_fields) ]
21
21
pub struct Config {
22
+ /// Config for reading messages from plugins and forwarding to Svix.
22
23
#[ serde( default ) ]
23
- pub senders : Vec < SenderConfig > ,
24
+ pub senders : Vec < WebhookSenderConfig > ,
25
+ /// Config for receiving webhooks and forwarding them to plugins.
24
26
#[ serde( default ) ]
25
- pub receivers : Vec < ReceiverConfig > ,
27
+ pub receivers : Vec < WebhookReceiverConfig > ,
26
28
/// The log level to run the service with. Supported: info, debug, trace
27
29
#[ serde( default ) ]
28
30
pub log_level : LogLevel ,
@@ -141,9 +143,10 @@ pub enum LogFormat {
141
143
Json ,
142
144
}
143
145
146
+ /// Config for reading messages from plugins and forwarding to Svix.
144
147
#[ derive( Deserialize ) ]
145
148
#[ serde( untagged) ]
146
- pub enum SenderConfig {
149
+ pub enum WebhookSenderConfig {
147
150
#[ cfg( any(
148
151
feature = "gcp-pubsub" ,
149
152
feature = "rabbitmq" ,
@@ -153,36 +156,37 @@ pub enum SenderConfig {
153
156
Queue ( QueueSenderConfig ) ,
154
157
}
155
158
156
- impl SenderConfig {
159
+ impl WebhookSenderConfig {
157
160
pub fn name ( & self ) -> & str {
158
161
match self {
159
- SenderConfig :: Queue ( cfg) => & cfg. name ,
162
+ WebhookSenderConfig :: Queue ( cfg) => & cfg. name ,
160
163
}
161
164
}
162
165
pub fn transformation ( & self ) -> Option < & TransformationConfig > {
163
166
match self {
164
- SenderConfig :: Queue ( cfg) => cfg. transformation . as_ref ( ) ,
167
+ WebhookSenderConfig :: Queue ( cfg) => cfg. transformation . as_ref ( ) ,
165
168
}
166
169
}
167
170
}
168
171
169
- impl TryFrom < SenderConfig > for Box < dyn SenderInput > {
172
+ impl TryFrom < WebhookSenderConfig > for Box < dyn SenderInput > {
170
173
type Error = & ' static str ;
171
- fn try_from ( value : SenderConfig ) -> Result < Self , Self :: Error > {
174
+ fn try_from ( value : WebhookSenderConfig ) -> Result < Self , Self :: Error > {
172
175
match value {
173
176
#[ cfg( any(
174
177
feature = "gcp-pubsub" ,
175
178
feature = "rabbitmq" ,
176
179
feature = "redis" ,
177
180
feature = "sqs"
178
181
) ) ]
179
- SenderConfig :: Queue ( backend) => backend. into_sender_input ( ) ,
182
+ WebhookSenderConfig :: Queue ( backend) => backend. into_sender_input ( ) ,
180
183
}
181
184
}
182
185
}
183
186
187
+ /// Config for receiving webhooks and forwarding them to plugins.
184
188
#[ derive( Deserialize ) ]
185
- pub struct ReceiverConfig {
189
+ pub struct WebhookReceiverConfig {
186
190
pub name : String ,
187
191
pub input : ReceiverInputOpts ,
188
192
#[ serde( default ) ]
@@ -202,7 +206,7 @@ pub enum ReceiverOut {
202
206
Queue ( QueueOutOpts ) ,
203
207
}
204
208
205
- impl ReceiverConfig {
209
+ impl WebhookReceiverConfig {
206
210
pub async fn into_receiver_output ( self ) -> std:: io:: Result < Box < dyn ReceiverOutput > > {
207
211
match self . output {
208
212
ReceiverOut :: Queue ( x) => {
0 commit comments