File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -39,10 +39,8 @@ use url::Url;
39
39
static AUDIT_LOGGER : Lazy < Option < AuditLogger > > = Lazy :: new ( AuditLogger :: new) ;
40
40
41
41
pub struct AuditLogger {
42
- client : Arc < Client > ,
42
+ client : Client ,
43
43
log_endpoint : Url ,
44
- username : Option < String > ,
45
- password : Option < String > ,
46
44
}
47
45
48
46
impl AuditLogger {
@@ -62,16 +60,9 @@ impl AuditLogger {
62
60
}
63
61
} ;
64
62
65
- let client = Arc :: new ( reqwest:: Client :: new ( ) ) ;
66
-
67
- let username = CONFIG . parseable . audit_username . clone ( ) ;
68
- let password = CONFIG . parseable . audit_password . clone ( ) ;
69
-
70
63
Some ( AuditLogger {
71
- client,
64
+ client : reqwest :: Client :: new ( ) ,
72
65
log_endpoint,
73
- username,
74
- password,
75
66
} )
76
67
}
77
68
@@ -81,8 +72,10 @@ impl AuditLogger {
81
72
. post ( self . log_endpoint . as_str ( ) )
82
73
. json ( & json)
83
74
. header ( "x-p-stream" , "audit_log" ) ;
84
- if let Some ( username) = self . username . as_ref ( ) {
85
- req = req. basic_auth ( username, self . password . as_ref ( ) )
75
+
76
+ // Use basic auth if credentials are configured
77
+ if let Some ( username) = CONFIG . parseable . audit_username . as_ref ( ) {
78
+ req = req. basic_auth ( username, CONFIG . parseable . audit_password . as_ref ( ) )
86
79
}
87
80
88
81
match req. send ( ) . await {
You can’t perform that action at this time.
0 commit comments