1use std::time::Duration;
2
3#[derive(Debug)]
5pub struct BridgeConfigData {
6 ledger_uri: String,
7 ledger_connect_timeout: Duration,
8 ledger_timeout: Duration,
9 ledger_token: String,
10 http_host: String,
11 http_port: u16,
12 package_reload_interval: Duration,
13 encode_int64_as_string: bool,
14 encode_decimal_as_string: bool,
15}
16
17impl BridgeConfigData {
18 #[allow(clippy::too_many_arguments)]
19 pub const fn new(
20 ledger_uri: String,
21 ledger_connect_timeout: Duration,
22 ledger_timeout: Duration,
23 ledger_token: String,
24 http_host: String,
25 http_port: u16,
26 package_reload_interval: Duration,
27 encode_int64_as_string: bool,
28 encode_decimal_as_string: bool,
29 ) -> Self {
30 Self {
31 ledger_uri,
32 ledger_connect_timeout,
33 ledger_timeout,
34 ledger_token,
35 http_host,
36 http_port,
37 package_reload_interval,
38 encode_int64_as_string,
39 encode_decimal_as_string,
40 }
41 }
42
43 pub fn ledger_uri(&self) -> &str {
44 &self.ledger_uri
45 }
46
47 pub const fn ledger_connect_timeout(&self) -> Duration {
48 self.ledger_connect_timeout
49 }
50
51 pub const fn ledger_timeout(&self) -> Duration {
52 self.ledger_timeout
53 }
54
55 pub fn ledger_token(&self) -> &str {
56 &self.ledger_token
57 }
58
59 pub fn http_host(&self) -> &str {
60 &self.http_host
61 }
62
63 pub const fn http_port(&self) -> u16 {
64 self.http_port
65 }
66
67 pub const fn package_reload_interval(&self) -> Duration {
68 self.package_reload_interval
69 }
70
71 pub const fn encode_int64_as_string(&self) -> bool {
72 self.encode_int64_as_string
73 }
74
75 pub const fn encode_decimal_as_string(&self) -> bool {
76 self.encode_decimal_as_string
77 }
78}