@@ -5,6 +5,7 @@ package root
55
66import (
77 "context"
8+ "net/http"
89
910 "github.com/cartesi/rollups-node/internal/claimer"
1011 "github.com/cartesi/rollups-node/internal/config"
@@ -105,14 +106,22 @@ func run(cmd *cobra.Command, args []string) {
105106 Config : * cfg ,
106107 }
107108
109+ clientOptions := []rpc.ClientOption {}
108110 rclient := retryablehttp .NewClient ()
109111 rclient .Logger = service .NewLogger (cfg .LogLevel , cfg .LogColor ).With ("service" , serviceName )
110112 rclient .RetryMax = int (cfg .BlockchainHttpMaxRetries )
111113 rclient .RetryWaitMin = cfg .BlockchainHttpRetryMinWait
112114 rclient .RetryWaitMax = cfg .BlockchainHttpRetryMaxWait
115+ clientOptions = append (clientOptions , rpc .WithHTTPClient (rclient .StandardClient ()))
113116
114- clientOption := rpc .WithHTTPClient (rclient .StandardClient ())
115- rpcClient , err := rpc .DialOptions (ctx , cfg .BlockchainHttpEndpoint .String (), clientOption )
117+ if cfg .BlockchainHttpAuthorization .Value != "undefined" {
118+ clientOptions = append (clientOptions , rpc .WithHTTPAuth (func (h http.Header ) error {
119+ h .Set ("Authorization" , cfg .BlockchainHttpAuthorization .Value )
120+ return nil
121+ }))
122+ }
123+
124+ rpcClient , err := rpc .DialOptions (ctx , cfg .BlockchainHttpEndpoint .String (), clientOptions ... )
116125 cobra .CheckErr (err )
117126 createInfo .EthConn = ethclient .NewClient (rpcClient )
118127
0 commit comments