File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed
Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 1-
1+ authorization: {
2+ users: [
3+ { nkey: UDMBGUBEOCJVCOXHSQGYRX4SGS3QEAEDIVNHDBD63YEKHSGPVO53I2NU }
4+ ]
5+ }
26jetstream = {
37 max_file_store = 21474836480
48}
Original file line number Diff line number Diff line change @@ -44,15 +44,25 @@ pub struct Publisher {
4444impl Publisher {
4545 pub async fn new (
4646 nats_url : & str ,
47+ nats_nkey : Option < String > ,
4748 chain_id : ChainId ,
4849 base_asset_id : AssetId ,
4950 fuel_database : CombinedDatabase ,
5051 block_subscription : Receiver < Arc < dyn Deref < Target = ImportResult > + Send + Sync > > ,
5152 ) -> anyhow:: Result < Self > {
5253 // Connect to the NATS server
53- let client = async_nats:: connect ( nats_url)
54+ let client = match nats_nkey {
55+ Some ( nkey) => async_nats:: connect_with_options (
56+ nats_url,
57+ async_nats:: ConnectOptions :: with_nkey ( nkey) ,
58+ )
5459 . await
55- . context ( format ! ( "Connecting to {nats_url}" ) ) ?;
60+ . context ( format ! ( "Connecting to {nats_url}" ) ) ?,
61+ None => async_nats:: connect ( nats_url)
62+ . await
63+ . context ( format ! ( "Connecting to {nats_url}" ) ) ?,
64+ } ;
65+
5666 let max_payload_size = client. server_info ( ) . max_payload ;
5767 info ! ( "NATS Publisher: max_payload_size={max_payload_size}" ) ;
5868 // Create a JetStream context
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ pub struct Cli {
1212 default_value = "localhost:4222"
1313 ) ]
1414 nats_url : String ,
15+ #[ arg( long, value_name = "NKEY" , env = "NATS_NKEY" ) ]
16+ nats_nkey : Option < String > ,
1517 #[ command( flatten) ]
1618 fuel_core_config : run:: Command ,
1719}
@@ -31,6 +33,7 @@ async fn main() -> anyhow::Result<()> {
3133
3234 let publisher = fuel_core_nats:: Publisher :: new (
3335 & cli. nats_url ,
36+ cli. nats_nkey ,
3437 chain_id,
3538 * base_asset_id,
3639 service. shared . database . clone ( ) ,
You can’t perform that action at this time.
0 commit comments