@@ -63,17 +63,18 @@ Note that there is an Oracle and Exporter for each network, but only one Local S
63
63
################################################################################################################################## */
64
64
use {
65
65
self :: {
66
- config:: Config ,
67
66
pyth:: rpc,
68
67
solana:: network,
69
68
} ,
70
69
anyhow:: Result ,
70
+ config:: Config ,
71
71
futures_util:: future:: join_all,
72
72
lazy_static:: lazy_static,
73
73
std:: sync:: Arc ,
74
74
tokio:: sync:: watch,
75
75
} ;
76
76
77
+ pub mod config;
77
78
pub mod legacy_schedule;
78
79
pub mod market_schedule;
79
80
pub mod metrics;
@@ -177,91 +178,3 @@ impl Agent {
177
178
Ok ( ( ) )
178
179
}
179
180
}
180
-
181
- pub mod config {
182
- use {
183
- super :: {
184
- metrics,
185
- pyth,
186
- services,
187
- solana:: network,
188
- state,
189
- } ,
190
- anyhow:: Result ,
191
- config as config_rs,
192
- config_rs:: {
193
- Environment ,
194
- File ,
195
- } ,
196
- serde:: Deserialize ,
197
- std:: path:: Path ,
198
- } ;
199
-
200
- /// Configuration for all components of the Agent
201
- #[ derive( Deserialize , Debug ) ]
202
- pub struct Config {
203
- #[ serde( default ) ]
204
- pub channel_capacities : ChannelCapacities ,
205
- pub primary_network : network:: Config ,
206
- pub secondary_network : Option < network:: Config > ,
207
- #[ serde( default ) ]
208
- #[ serde( rename = "pythd_adapter" ) ]
209
- pub state : state:: Config ,
210
- #[ serde( default ) ]
211
- pub pythd_api_server : pyth:: rpc:: Config ,
212
- #[ serde( default ) ]
213
- pub metrics_server : metrics:: Config ,
214
- #[ serde( default ) ]
215
- pub remote_keypair_loader : services:: keypairs:: Config ,
216
- }
217
-
218
- impl Config {
219
- pub fn new ( config_file : impl AsRef < Path > ) -> Result < Self > {
220
- // Build a new configuration object, allowing the default values to be
221
- // overridden by those in the config_file or "AGENT_"-prefixed environment
222
- // variables.
223
- config_rs:: Config :: builder ( )
224
- . add_source ( File :: from ( config_file. as_ref ( ) ) )
225
- . add_source ( Environment :: with_prefix ( "agent" ) )
226
- . build ( ) ?
227
- . try_deserialize ( )
228
- . map_err ( |e| e. into ( ) )
229
- }
230
- }
231
-
232
- /// Capacities of the channels top-level components use to communicate
233
- #[ derive( Deserialize , Debug ) ]
234
- pub struct ChannelCapacities {
235
- /// Capacity of the channel used to broadcast shutdown events to all components
236
- pub shutdown : usize ,
237
- /// Capacity of the channel used to send updates from the primary Oracle to the Global Store
238
- pub primary_oracle_updates : usize ,
239
- /// Capacity of the channel used to send updates from the secondary Oracle to the Global Store
240
- pub secondary_oracle_updates : usize ,
241
- /// Capacity of the channel the Pythd API Adapter uses to send lookup requests to the Global Store
242
- pub global_store_lookup : usize ,
243
- /// Capacity of the channel the Pythd API Adapter uses to communicate with the Local Store
244
- pub local_store_lookup : usize ,
245
- /// Capacity of the channel on which the Local Store receives messages
246
- pub local_store : usize ,
247
- /// Capacity of the channel on which the Pythd API Adapter receives messages
248
- pub pythd_adapter : usize ,
249
- /// Capacity of the slog logging channel. Adjust this value if you see complaints about channel capacity from slog
250
- pub logger_buffer : usize ,
251
- }
252
-
253
- impl Default for ChannelCapacities {
254
- fn default ( ) -> Self {
255
- Self {
256
- shutdown : 10000 ,
257
- primary_oracle_updates : 10000 ,
258
- secondary_oracle_updates : 10000 ,
259
- global_store_lookup : 10000 ,
260
- local_store_lookup : 10000 ,
261
- local_store : 10000 ,
262
- pythd_adapter : 10000 ,
263
- logger_buffer : 10000 ,
264
- }
265
- }
266
- }
267
- }
0 commit comments