Struct actix_treblle::Treblle
source · [−]pub struct Treblle { /* private fields */ }
Implementations
sourceimpl Treblle
impl Treblle
sourcepub fn new(project_id: String, api_key: String) -> Treblle
pub fn new(project_id: String, api_key: String) -> Treblle
Create the middleware and wrap your application with it.
HttpServer::new(|| {
App::new()
.wrap(actix_treblle::Treblle::new("project_id".to_string(), "api_key".to_string()))
.route("/hello", web::get().to(|| async { "Hello World!" }))
})
.bind(("127.0.0.1", 8080))?
.run()
.await
sourcepub fn debug(self) -> Treblle
pub fn debug(self) -> Treblle
Turn on the debug mode
WARNING: Turning this option ON can slow down your requests by 10 fold sometimes because we are waiting for the response from Treblle.com.
HttpServer::new(|| {
App::new()
.wrap(
actix_treblle::Treblle::new("project_id".to_string(), "api_key".to_string())
.debug()
)
.route("/hello", web::get().to(|| async { "Hello World!" }))
})
.bind(("127.0.0.1", 8080))?
.run()
.await
sourcepub fn clear_masking_fields(self) -> Treblle
pub fn clear_masking_fields(self) -> Treblle
If you don’t wish to have default masking fields, or simply want to remove the default ones use this method when wrapping your application with this middleware.
HttpServer::new(|| {
App::new()
.wrap(
actix_treblle::Treblle::new("project_id".to_string(), "api_key".to_string())
.clear_masking_fields()
)
.route("/hello", web::get().to(|| async { "Hello World!" }))
})
.bind(("127.0.0.1", 8080))?
.run()
.await
sourcepub fn add_masking_fields(self, fields: Vec<String>) -> Treblle
pub fn add_masking_fields(self, fields: Vec<String>) -> Treblle
Set masking fields that will be masked before the request leaves your application
Default masking fields:
- “password”
- “pwd”
- “secret”
- “password_confirmation”
- “passwordConfirmation”
- “cc”
- “card_number”
- “cardNumber”
- “ccv”
- “ssn”
- “credit_score”
- “creditScore”
HttpServer::new(|| {
App::new()
.wrap(
actix_treblle::Treblle::new("project_id".to_string(), "api_key".to_string())
.add_masking_fields(vec![
"password".to_string(),
"ssl_key".to_string(),
"cookie".to_string(),
"csrf".to_string(),
])
)
.route("/hello", web::get().to(|| async { "Hello World!" }))
})
.bind(("127.0.0.1", 8080))?
.run()
.await
sourcepub fn add_ignored_routes(self, routes: Vec<String>) -> Treblle
pub fn add_ignored_routes(self, routes: Vec<String>) -> Treblle
Add routes that will be ignored for logging
Add a vector of route matching patterns, same as you would define them in your application.
HttpServer::new(|| {
App::new()
.wrap(
actix_treblle::Treblle::new("project_id".to_string(), "api_key".to_string())
.add_ignored_routes(vec![
"/users/{user_id}".to_string(),
"/users/{user_id}/change-password".to_string(),
])
)
.route("/hello", web::get().to(|| async { "Hello World!" }))
})
.bind(("127.0.0.1", 8080))?
.run()
.await
Trait Implementations
sourceimpl<S: 'static> Transform<S, ServiceRequest> for Treblle where
S: Service<ServiceRequest, Response = ServiceResponse, Error = Error>,
S::Future: 'static,
impl<S: 'static> Transform<S, ServiceRequest> for Treblle where
S: Service<ServiceRequest, Response = ServiceResponse, Error = Error>,
S::Future: 'static,
type Response = ServiceResponse<BoxBody>
type Response = ServiceResponse<BoxBody>
Responses produced by the service.
type Transform = TreblleMiddleware<S>
type Transform = TreblleMiddleware<S>
The TransformService
value created by this factory
type Future = Ready<Result<<Treblle as Transform<S, ServiceRequest>>::Transform, <Treblle as Transform<S, ServiceRequest>>::InitError>>
type Future = Ready<Result<<Treblle as Transform<S, ServiceRequest>>::Transform, <Treblle as Transform<S, ServiceRequest>>::InitError>>
The future response value.
sourcefn new_transform(&self, service: S) -> Self::Future
fn new_transform(&self, service: S) -> Self::Future
Creates and returns a new Transform component, asynchronously
Auto Trait Implementations
impl RefUnwindSafe for Treblle
impl Send for Treblle
impl Sync for Treblle
impl Unpin for Treblle
impl UnwindSafe for Treblle
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more