File tree 4 files changed +31
-14
lines changed
packages/configuration/src/v1
4 files changed +31
-14
lines changed Original file line number Diff line number Diff line change @@ -11,3 +11,11 @@ pub struct HealthCheckApi {
11
11
/// system to choose a random port, use port `0`.
12
12
pub bind_address : String ,
13
13
}
14
+
15
+ impl Default for HealthCheckApi {
16
+ fn default ( ) -> Self {
17
+ Self {
18
+ bind_address : String :: from ( "127.0.0.1:1313" ) ,
19
+ }
20
+ }
21
+ }
Original file line number Diff line number Diff line change @@ -21,3 +21,15 @@ pub struct HttpTracker {
21
21
#[ serde_as( as = "NoneAsEmptyString" ) ]
22
22
pub ssl_key_path : Option < String > ,
23
23
}
24
+
25
+ impl Default for HttpTracker {
26
+ fn default ( ) -> Self {
27
+ Self {
28
+ enabled : false ,
29
+ bind_address : String :: from ( "0.0.0.0:7070" ) ,
30
+ ssl_enabled : false ,
31
+ ssl_cert_path : None ,
32
+ ssl_key_path : None ,
33
+ }
34
+ }
35
+ }
Original file line number Diff line number Diff line change @@ -346,21 +346,10 @@ impl Default for Configuration {
346
346
udp_trackers : Vec :: new ( ) ,
347
347
http_trackers : Vec :: new ( ) ,
348
348
http_api : HttpApi :: default ( ) ,
349
- health_check_api : HealthCheckApi {
350
- bind_address : String :: from ( "127.0.0.1:1313" ) ,
351
- } ,
349
+ health_check_api : HealthCheckApi :: default ( ) ,
352
350
} ;
353
- configuration. udp_trackers . push ( UdpTracker {
354
- enabled : false ,
355
- bind_address : String :: from ( "0.0.0.0:6969" ) ,
356
- } ) ;
357
- configuration. http_trackers . push ( HttpTracker {
358
- enabled : false ,
359
- bind_address : String :: from ( "0.0.0.0:7070" ) ,
360
- ssl_enabled : false ,
361
- ssl_cert_path : None ,
362
- ssl_key_path : None ,
363
- } ) ;
351
+ configuration. udp_trackers . push ( UdpTracker :: default ( ) ) ;
352
+ configuration. http_trackers . push ( HttpTracker :: default ( ) ) ;
364
353
configuration
365
354
}
366
355
}
Original file line number Diff line number Diff line change @@ -10,3 +10,11 @@ pub struct UdpTracker {
10
10
/// system to choose a random port, use port `0`.
11
11
pub bind_address : String ,
12
12
}
13
+ impl Default for UdpTracker {
14
+ fn default ( ) -> Self {
15
+ Self {
16
+ enabled : false ,
17
+ bind_address : String :: from ( "0.0.0.0:6969" ) ,
18
+ }
19
+ }
20
+ }
You can’t perform that action at this time.
0 commit comments