Skip to content

Commit

Permalink
update: gathering ch info from env vars and also support passing REGI…
Browse files Browse the repository at this point in the history
…ON explicitly
  • Loading branch information
riccardo-gnosis committed Sep 12, 2024
1 parent 8c71ad9 commit 5e722d2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
35 changes: 19 additions & 16 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,27 @@ var ConsumerCommand = &cli.Command{
Value: "consumer-" + uuid.New().String(),
},
&cli.StringFlag{
Name: "endpoint",
Usage: "Clickhouse server endpoint",
Value: "", // If empty URL, run the consumer without Clickhouse
Name: "endpoint",
Usage: "Clickhouse server endpoint",
Value: "", // If empty URL, run the consumer without Clickhouse
EnvVar: "VALTRACK_CH_URL",
},
&cli.StringFlag{
Name: "db",
Usage: "Clickhouse database name",
Value: "default",
},
&cli.StringFlag{
Name: "username",
Usage: "Clickhouse username",
Value: "default",
Name: "username",
Usage: "Clickhouse username",
Value: "default",
EnvVar: "CLICKHOUSE_USER",
},
&cli.StringFlag{
Name: "password",
Usage: "Clickhouse password",
Value: "",
Name: "password",
Usage: "Clickhouse password",
Value: "",
EnvVar: "CLICKHOUSE_PASSWORD",
},
&cli.StringFlag{
Name: "dune.namespace",
Expand Down Expand Up @@ -116,13 +119,13 @@ func runConsumer(c *cli.Context) error {
DuneNamespace: c.String("dune.namespace"),
DuneApiKey: c.String("dune.api-key"),
ChCfg: clickhouse.ClickhouseConfig{
Endpoint: c.String("endpoint"),
DB: c.String("db"),
Username: c.String("username"),
Password: c.String("password"),
MaxValidatorBatchSize: c.Uint64("max-validator-batch-size"),
MaxIPMetadataBatchSize: c.Uint64("max-ip-metadata-batch-size"),
MaxPeerDiscoveredEventsBatchSize: c.Uint64("max-peer-discovered-events-batch-size"),
Endpoint: c.String("endpoint"),
DB: c.String("db"),
Username: c.String("username"),
Password: c.String("password"),
MaxValidatorBatchSize: c.Uint64("max-validator-batch-size"),
MaxIPMetadataBatchSize: c.Uint64("max-ip-metadata-batch-size"),
MaxPeerDiscoveredEventsBatchSize: c.Uint64("max-peer-discovered-events-batch-size"),
MaxMetadataReceivedEventsBatchSize: c.Uint64("max-metadata-received-events-batch-size"),
},
}
Expand Down
6 changes: 6 additions & 0 deletions pkg/ethereum/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ func getCrawlerLocation() string {
if region := os.Getenv("AWS_REGION"); region != "" {
return region
}
if region := os.Getenv("AWS_DEFAULT_REGION"); region != "" {
return region
}
if region := os.Getenv("REGION"); region != "" {
return region
}
return "UNKOWN_REGION"
}

Expand Down

0 comments on commit 5e722d2

Please sign in to comment.