Skip to content

Commit

Permalink
CHAIN-1547: Set ENABLE_COMPRESSION flag (#9)
Browse files Browse the repository at this point in the history
When running we default to compression payload, using `application/zstd`. We get back:
`{"error":"Invalid content type 'application/zstd'. We support CSV (Content-Type: text/csv) and newline delimited JSON (Content-Type: application/x-ndjson"}`

We customize the behavior using `ENABLE_COMPRESSION=false` flag.
  • Loading branch information
helanto authored Jun 7, 2024
1 parent fdc05e0 commit 7174033
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
9 changes: 5 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ func main() {
}

duneClient, err := duneapi.New(logger, duneapi.Config{
APIKey: cfg.Dune.APIKey,
URL: cfg.Dune.URL,
BlockchainName: cfg.BlockchainName,
Stack: cfg.RPCStack,
APIKey: cfg.Dune.APIKey,
URL: cfg.Dune.URL,
BlockchainName: cfg.BlockchainName,
Stack: cfg.RPCStack,
DisableCompression: !cfg.EnableCompression,
})
if err != nil {
stdlog.Fatal(err)
Expand Down
13 changes: 7 additions & 6 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ func (r RPCClient) HasError() error {
}

type Config struct {
BlockHeight int64 `long:"block-height" env:"BLOCK_HEIGHT" description:"block height to start from" default:"-1"` // nolint:lll
BlockchainName string `long:"blockchain-name" env:"BLOCKCHAIN_NAME" description:"name of the blockchain" required:"true"` // nolint:lll
Dune DuneClient
PollInterval time.Duration `long:"rpc-poll-interval" env:"RPC_POLL_INTERVAL" description:"Interval to poll the blockchain node" default:"500ms"` // nolint:lll
RPCNode RPCClient
RPCStack models.EVMStack `long:"rpc-stack" env:"RPC_STACK" description:"Stack for the RPC client" default:"opstack"` // nolint:lll
BlockHeight int64 `long:"block-height" env:"BLOCK_HEIGHT" description:"block height to start from" default:"-1"` // nolint:lll
BlockchainName string `long:"blockchain-name" env:"BLOCKCHAIN_NAME" description:"name of the blockchain" required:"true"` // nolint:lll
EnableCompression bool `long:"enable-compression" env:"ENABLE_COMPRESSION" description:"enable compression when pushing payload to Dune"` // nolint:lll
Dune DuneClient
PollInterval time.Duration `long:"rpc-poll-interval" env:"RPC_POLL_INTERVAL" description:"Interval to poll the blockchain node" default:"500ms"` // nolint:lll
RPCNode RPCClient
RPCStack models.EVMStack `long:"rpc-stack" env:"RPC_STACK" description:"Stack for the RPC client" default:"opstack"` // nolint:lll
}

func (c Config) HasError() error {
Expand Down

0 comments on commit 7174033

Please sign in to comment.