Skip to content

Commit

Permalink
Setup preprod to use the sidecar
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcgary committed Nov 25, 2024
1 parent ab9072f commit 19ecd72
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func init() {
rootCmd.PersistentFlags().String("rewards-coordinator-address", "0x56c119bD92Af45eb74443ab14D4e93B7f5C67896", "Ethereum address of the rewards coordinator contract")
rootCmd.PersistentFlags().String("proof-store-base-url", "", "HTTP base url where data is stored")
rootCmd.PersistentFlags().String("sidecar-rpc-url", "", "Sidecar RPC URL")
rootCmd.PersistentFlags().Bool("sidecar-insecure-rpc", false, "Use insecure gRPC connection to sidecar")
rootCmd.PersistentFlags().Bool("pushgateway-enabled", false, "Enable/disable pushgateway metrics collection")
rootCmd.PersistentFlags().String("pushgateway-url", "", "URL to use for Pushgateway. This option is ignored if pushgateway-enable is not set.")

Expand Down
2 changes: 1 addition & 1 deletion cmd/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func runUpdater(ctx context.Context, cfg *config.UpdaterConfig, logger *zap.Logg
return err
}

sidecarClient, err := sidecar.NewSidecarClient(cfg.SidecarRpcUrl)
sidecarClient, err := sidecar.NewSidecarClient(cfg.SidecarRpcUrl, cfg.SidecarInsecureRpc)
if err != nil {
logger.Sugar().Errorf("Failed to create sidecar client", zap.Error(err))
return err
Expand Down
3 changes: 2 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ type UpdaterConfig struct {
RPCUrl string `mapstructure:"rpc_url"`
PrivateKey string `mapstructure:"private_key"`
RewardsCoordinatorAddress string `mapstructure:"rewards_coordinator_address"`
ProofStoreBaseUrl string `mapstructure:"proof_store_base_url"`
SidecarRpcUrl string `mapstructure:"sidecar_rpc_url"`
SidecarInsecureRpc bool `mapstructure:"sidecar_insecure_rpc"`
}

type DistributionConfig struct {
Expand Down Expand Up @@ -138,6 +138,7 @@ func NewUpdaterConfig() *UpdaterConfig {
PrivateKey: viper.GetString("private_key"),
RewardsCoordinatorAddress: viper.GetString("rewards_coordinator_address"),
SidecarRpcUrl: viper.GetString("sidecar_rpc_url"),
SidecarInsecureRpc: viper.GetBool("sidecar_insecure_rpc"),
}
return updaterConfig
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/sidecar/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ type SidecarClient struct {
Rewards IRewardsClient
}

func NewSidecarClient(url string) (*SidecarClient, error) {
func NewSidecarClient(url string, insecureConn bool) (*SidecarClient, error) {
var creds grpc.DialOption
if strings.Contains(url, "localhost:") || strings.Contains(url, "127.0.0.1:") {
if strings.Contains(url, "localhost:") || strings.Contains(url, "127.0.0.1:") || insecureConn {
creds = grpc.WithTransportCredentials(insecure.NewCredentials())
} else {
creds = grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{InsecureSkipVerify: false}))
Expand Down

0 comments on commit 19ecd72

Please sign in to comment.