8
8
//! routes and their handler functions.
9
9
//!
10
10
//! ```
11
- //! use stackable_webhook::{WebhookServer, Options };
11
+ //! use stackable_webhook::{WebhookServer, WebhookOptions };
12
12
//! use axum::Router;
13
13
//!
14
14
//! # async fn test() {
15
15
//! let router = Router::new();
16
- //! let (server, cert_rx) = WebhookServer::new(router, Options ::default())
16
+ //! let (server, cert_rx) = WebhookServer::new(router, WebhookOptions ::default())
17
17
//! .await
18
18
//! .expect("failed to create WebhookServer");
19
19
//! # }
@@ -46,7 +46,7 @@ pub mod servers;
46
46
pub mod tls;
47
47
48
48
// Selected re-exports
49
- pub use crate :: options:: Options ;
49
+ pub use crate :: options:: WebhookOptions ;
50
50
51
51
/// A generic webhook handler receiving a request and sending back a response.
52
52
///
@@ -88,23 +88,23 @@ pub struct WebhookServer {
88
88
impl WebhookServer {
89
89
/// Creates a new ready-to-use webhook server.
90
90
///
91
- /// The server listens on `socket_addr` which is provided via the [`Options`]
92
- /// and handles routing based on the provided Axum `router`. Most of the time
93
- /// it is sufficient to use [`Options ::default()`]. See the documentation
94
- /// for [`Options`] for more details on the default values.
91
+ /// The server listens on `socket_addr` which is provided via the [`WebhookOptions`] and handles
92
+ /// routing based on the provided Axum `router`. Most of the time it is sufficient to use
93
+ /// [`WebhookOptions ::default()`]. See the documentation for [`WebhookOptions`] for more details
94
+ /// on the default values.
95
95
///
96
96
/// To start the server, use the [`WebhookServer::run()`] function. This will
97
97
/// run the server using the Tokio runtime until it is terminated.
98
98
///
99
99
/// ### Basic Example
100
100
///
101
101
/// ```
102
- /// use stackable_webhook::{WebhookServer, Options };
102
+ /// use stackable_webhook::{WebhookServer, WebhookOptions };
103
103
/// use axum::Router;
104
104
///
105
105
/// # async fn test() {
106
106
/// let router = Router::new();
107
- /// let (server, cert_rx) = WebhookServer::new(router, Options ::default())
107
+ /// let (server, cert_rx) = WebhookServer::new(router, WebhookOptions ::default())
108
108
/// .await
109
109
/// .expect("failed to create WebhookServer");
110
110
/// # }
@@ -113,11 +113,11 @@ impl WebhookServer {
113
113
/// ### Example with Custom Options
114
114
///
115
115
/// ```
116
- /// use stackable_webhook::{WebhookServer, Options };
116
+ /// use stackable_webhook::{WebhookServer, WebhookOptions };
117
117
/// use axum::Router;
118
118
///
119
119
/// # async fn test() {
120
- /// let options = Options ::builder()
120
+ /// let options = WebhookOptions ::builder()
121
121
/// .bind_address([127, 0, 0, 1], 8080)
122
122
/// .add_subject_alterative_dns_name("my-san-entry")
123
123
/// .build();
@@ -130,7 +130,7 @@ impl WebhookServer {
130
130
/// ```
131
131
pub async fn new (
132
132
router : Router ,
133
- options : Options ,
133
+ options : WebhookOptions ,
134
134
) -> Result < ( Self , mpsc:: Receiver < Certificate > ) > {
135
135
tracing:: trace!( "create new webhook server" ) ;
136
136
@@ -154,13 +154,9 @@ impl WebhookServer {
154
154
. route ( "/health" , get ( || async { "ok" } ) ) ;
155
155
156
156
tracing:: debug!( "create TLS server" ) ;
157
- let ( tls_server, cert_rx) = TlsServer :: new (
158
- options. socket_addr ,
159
- router,
160
- options. subject_alterative_dns_names ,
161
- )
162
- . await
163
- . context ( CreateTlsServerSnafu ) ?;
157
+ let ( tls_server, cert_rx) = TlsServer :: new ( router, options)
158
+ . await
159
+ . context ( CreateTlsServerSnafu ) ?;
164
160
165
161
Ok ( ( Self { tls_server } , cert_rx) )
166
162
}
0 commit comments