-
Notifications
You must be signed in to change notification settings - Fork 87
/
Copy pathcommon.rs
143 lines (121 loc) · 4.01 KB
/
common.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
use celestia_types::nmt::Namespace;
use godfig::env_default;
// The default hostname for the Celestia RPC
env_default!(
default_celestia_rpc_listen_hostname,
"CELESTIA_RPC_LISTEN_HOSTNAME",
String,
"0.0.0.0".to_string()
);
// The default port for the Celestia RPC
env_default!(default_celestia_rpc_listen_port, "CELESTIA_RPC_LISTEN_PORT", u16, 26657);
// The default Celestia RPC connection protocol
env_default!(
default_celestia_rpc_connection_protocol,
"CELESTIA_RPC_CONNECTION_PROTOCOL",
String,
"http".to_string()
);
// The default Celestia RPC connection hostname
env_default!(
default_celestia_rpc_connection_hostname,
"CELESTIA_RPC_CONNECTION_HOSTNAME",
String,
"0.0.0.0".to_string()
);
// The default Celestia RPC connection port
env_default!(default_celestia_rpc_connection_port, "CELESTIA_RPC_CONNECTION_PORT", u16, 26657);
// The default hostname for the Celestia Node websocket
env_default!(
default_celestia_websocket_listen_hostname,
"CELESTIA_WEBSOCKET_LISTEN_HOSTNAME",
String,
"0.0.0.0".to_string()
);
// The default port for the Celestia Node websocket
env_default!(default_celestia_websocket_listen_port, "CELESTIA_WEBSOCKET_LISTEN_PORT", u16, 26658);
// the default Celestia Node websocket connection protocol
env_default!(
default_celestia_websocket_connection_protocol,
"CELESTIA_WEBSOCKET_CONNECTION_PROTOCOL",
String,
"ws".to_string()
);
// The default Celestia Node websocket connection hostname
env_default!(
default_celestia_websocket_connection_hostname,
"CELESTIA_WEBSOCKET_CONNECTION_HOSTNAME",
String,
"0.0.0.0".to_string()
);
// The default Celestia Node websocket connection port
env_default!(
default_celestia_websocket_connection_port,
"CELESTIA_WEBSOCKET_CONNECTION_PORT",
u16,
26658
);
// The default M1 DA Light Node listen hostname
env_default!(
default_m1_da_light_node_listen_hostname,
"M1_DA_LIGHT_NODE_LISTEN_HOSTNAME",
String,
"0.0.0.0".to_string()
);
// The default M1 DA Light Node listen port
env_default!(default_m1_da_light_node_listen_port, "M1_DA_LIGHT_NODE_LISTEN_PORT", u16, 30730);
// The default M1 DA Light Node connection hostname
env_default!(
default_m1_da_light_node_connection_hostname,
"M1_DA_LIGHT_NODE_CONNECTION_HOSTNAME",
String,
"0.0.0.0".to_string()
);
// The default M1 DA Light Node connection port
env_default!(
default_m1_da_light_node_connection_port,
"M1_DA_LIGHT_NODE_CONNECTION_PORT",
u16,
30730
);
// The default Celestia Namespace
pub fn default_celestia_namespace() -> Namespace {
match std::env::var("CELESTIA_NAMESPACE") {
Ok(val) => match serde_json::from_str(&val) {
Ok(namespace) => namespace,
// todo: get rid of this unwrap somehow, event though it should never fail
Err(_) => Namespace::new_v0(b"movement").unwrap(),
},
// todo: get rid of this unwrap somehow, event though it should never fail
Err(_) => Namespace::new_v0(b"movement").unwrap(),
}
}
// The default Celestia chain id
env_default!(default_celestia_chain_id, "CELESTIA_CHAIN_ID", String, "movement".to_string());
// Whether to force a new chain
env_default!(default_celestia_force_new_chain, "CELESTIA_FORCE_NEW_CHAIN", bool, true);
// Whether to use replace args for Celestia appd
env_default!(default_celestia_appd_use_replace_args, "CELESTIA_USE_REPLACE_ARGS", bool, false);
// The replacement args for Celestia appd
pub fn default_celestia_appd_replace_args() -> Vec<String> {
match std::env::var("CELESTIA_REPLACE_ARGS") {
Ok(val) => val.split(',').map(|s| s.to_string()).collect(),
Err(_) => vec![],
}
}
// Whether to use replace args for Celestia bridge
env_default!(
default_celestia_bridge_use_replace_args,
"CELESTIA_BRIDGE_USE_REPLACE_ARGS",
bool,
false
);
// The replacement args for Celestia bridge
pub fn default_celestia_bridge_replace_args() -> Vec<String> {
match std::env::var("CELESTIA_BRIDGE_REPLACE_ARGS") {
Ok(val) => val.split(',').map(|s| s.to_string()).collect(),
Err(_) => vec![],
}
}
// Whether to use replace args for Celestia bridge
env_default!(default_m1_da_light_node_is_initial, "M1_DA_LIGHT_NODE_IS_INITIAL", bool, true);