File tree Expand file tree Collapse file tree 4 files changed +39
-6
lines changed Expand file tree Collapse file tree 4 files changed +39
-6
lines changed Original file line number Diff line number Diff line change @@ -122,14 +122,14 @@ pub struct DatabaseURL(String);
122122impl From < & str > for DatabaseURL {
123123 fn from ( s : & str ) -> Self {
124124 let url: Self = Self ( s. to_owned ( ) ) ;
125- url. parse ( ) . expect ( "DatabaseURL is valid" ) ;
125+ url. parse ( ) . expect ( "DatabaseURL should be valid" ) ;
126126 url
127127 }
128128}
129129impl From < String > for DatabaseURL {
130130 fn from ( s : String ) -> Self {
131131 let url: Self = Self ( s) ;
132- url. parse ( ) . expect ( "DatabaseURL is valid" ) ;
132+ url. parse ( ) . expect ( "DatabaseURL should be valid" ) ;
133133 url
134134 }
135135}
@@ -160,7 +160,7 @@ impl DatabaseURL {
160160 }
161161 }
162162 let url: Self = Self ( url) ;
163- let _ = url. parse ( ) . expect ( "DatabaseURL is valid" ) ;
163+ let _ = url. parse ( ) . expect ( "DatabaseURL should be valid" ) ;
164164 url
165165 }
166166
Original file line number Diff line number Diff line change 1+ use fhevm_engine_common:: utils:: DatabaseURL ;
2+
3+ #[ tokio:: test]
4+ async fn mask_database_url ( ) {
5+ let db_url: DatabaseURL = "postgres://postgres:mypassword@localhost:5432/coprocessor" . into ( ) ;
6+
7+ let debug_fmt = format ! ( "{:?}" , db_url) ;
8+ assert ! ( !debug_fmt. contains( "mypassword" ) ) ;
9+
10+ let display_fmt = format ! ( "{}" , db_url) ;
11+ assert ! ( !display_fmt. contains( "mypassword" ) ) ;
12+ println ! ( "DatabaseURL: {}" , db_url) ;
13+
14+ let db_url: DatabaseURL = DatabaseURL :: new_with_app_name (
15+ "postgres://user:secret@dbhost:5432/mydb?sslmode=require" ,
16+ "tfhe-worker" ,
17+ ) ;
18+
19+ assert_eq ! (
20+ db_url. as_str( ) ,
21+ "postgres://user:secret@dbhost:5432/mydb?sslmode=require&application_name=tfhe-worker"
22+ ) ;
23+
24+ let db_url: DatabaseURL =
25+ DatabaseURL :: new_with_app_name ( "postgres://user:secret@dbhost:5432/mydb" , "tfhe-worker" ) ;
26+
27+ assert_eq ! (
28+ db_url. as_str( ) ,
29+ "postgres://user:secret@dbhost:5432/mydb?application_name=tfhe-worker"
30+ ) ;
31+
32+ println ! ( "DatabaseURL: {}" , db_url) ;
33+ }
Original file line number Diff line number Diff line change 99 "user_address" : " 0xa0534e99d86F081E8D3868A8C4732C8f65dfdB07" ,
1010 "scenario" : [
1111 [
12- 0.1 ,
13- 5
12+ 20.0 ,
13+ 120
1414 ]
1515 ]
1616 }
Original file line number Diff line number Diff line change @@ -346,7 +346,7 @@ impl EnvConfig {
346346 } ;
347347 let acl_contract_address: String = match env:: var ( "ACL_CONTRACT_ADDRESS" ) {
348348 Ok ( val) => val,
349- Err ( _) => "0x617E46088ffe8d0f27A123574119b9C3F3b81073 " . to_string ( ) ,
349+ Err ( _) => "0x05fD9B5EFE0a996095f42Ed7e77c390810CF660c " . to_string ( ) ,
350350 } ;
351351 let chain_id: i64 = match env:: var ( "CHAIN_ID" ) {
352352 Ok ( val) => val. parse :: < i64 > ( ) . unwrap ( ) ,
You can’t perform that action at this time.
0 commit comments