@@ -5,38 +5,46 @@ use crate::cli::DEFAULT_NYX_CHAIN_WATCHER_ID;
55use crate :: config:: payments_watcher:: HttpAuthenticationOptions :: AuthorizationBearerToken ;
66use crate :: config:: payments_watcher:: PaymentWatcherConfig ;
77use crate :: config:: { default_config_filepath, Config , ConfigBuilder , PaymentWatchersConfig } ;
8+ use crate :: env:: vars:: * ;
89use crate :: error:: NyxChainWatcherError ;
910use nym_config:: save_unformatted_config_to_file;
1011use nym_validator_client:: nyxd:: AccountId ;
1112use std:: str:: FromStr ;
1213
1314#[ derive( clap:: Args , Debug ) ]
14- pub ( crate ) struct Args { }
15+ pub ( crate ) struct Args {
16+ /// (Override) Postgres connection string for chain scraper history
17+ #[ arg( long, env = NYX_CHAIN_WATCHER_HISTORY_DATABASE_PATH , alias = "chain_history_db_path" ) ]
18+ pub ( crate ) chain_history_db_connection_string : String ,
19+ }
1520
16- pub ( crate ) async fn execute ( _args : Args ) -> Result < ( ) , NyxChainWatcherError > {
21+ pub ( crate ) async fn execute ( args : Args ) -> Result < ( ) , NyxChainWatcherError > {
1722 let config_path = default_config_filepath ( ) ;
1823 let data_dir = Config :: default_data_directory ( & config_path) ?;
1924
20- let builder = ConfigBuilder :: new ( config_path. clone ( ) , data_dir) . with_payment_watcher_config (
21- PaymentWatchersConfig {
22- watchers : vec ! [ PaymentWatcherConfig {
23- id: DEFAULT_NYX_CHAIN_WATCHER_ID . to_string( ) ,
24- webhook_url: "https://webhook.site" . to_string( ) ,
25- watch_for_transfer_recipient_accounts: vec![ AccountId :: from_str(
26- "n17g9a2pwwkg8m60wf59pq6mv0c2wusg9ukparkz" ,
27- )
28- . unwrap( ) ] ,
29- authentication: Some ( AuthorizationBearerToken {
30- token: "1234" . to_string( ) ,
31- } ) ,
32- description: None ,
33- watch_for_chain_message_types: vec![
34- "/cosmos.bank.v1beta1.MsgSend" . to_string( ) ,
35- "/ibc.applications.transfer.v1.MsgTransfer" . to_string( ) ,
36- ] ,
37- } ] ,
38- } ,
39- ) ;
25+ let builder = ConfigBuilder :: new (
26+ config_path. clone ( ) ,
27+ data_dir,
28+ args. chain_history_db_connection_string ,
29+ )
30+ . with_payment_watcher_config ( PaymentWatchersConfig {
31+ watchers : vec ! [ PaymentWatcherConfig {
32+ id: DEFAULT_NYX_CHAIN_WATCHER_ID . to_string( ) ,
33+ webhook_url: "https://webhook.site" . to_string( ) ,
34+ watch_for_transfer_recipient_accounts: vec![ AccountId :: from_str(
35+ "n17g9a2pwwkg8m60wf59pq6mv0c2wusg9ukparkz" ,
36+ )
37+ . unwrap( ) ] ,
38+ authentication: Some ( AuthorizationBearerToken {
39+ token: "1234" . to_string( ) ,
40+ } ) ,
41+ description: None ,
42+ watch_for_chain_message_types: vec![
43+ "/cosmos.bank.v1beta1.MsgSend" . to_string( ) ,
44+ "/ibc.applications.transfer.v1.MsgTransfer" . to_string( ) ,
45+ ] ,
46+ } ] ,
47+ } ) ;
4048
4149 let config = builder. build ( ) ;
4250
0 commit comments