Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add api key support for submit url #208

Merged
merged 3 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ type IndexerConfig struct {
}

type SubmitConfig struct {
Address string `yaml:"address" envconfig:"SUBMIT_TCP_ADDRESS"`
SocketPath string `yaml:"socketPath" envconfig:"SUBMIT_SOCKET_PATH"`
Url string `yaml:"url" envconfig:"SUBMIT_URL"`
Address string `yaml:"address" envconfig:"SUBMIT_TCP_ADDRESS"`
SocketPath string `yaml:"socketPath" envconfig:"SUBMIT_SOCKET_PATH"`
Url string `yaml:"url" envconfig:"SUBMIT_URL"`
BlockFrostProjectID string `yaml:"blockFrostProjectID" envconfig:"SUBMIT_BLOCKFROST_PROJECT_ID"`
}

type StorageConfig struct {
Expand Down
3 changes: 3 additions & 0 deletions internal/tx/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,9 @@ func submitTxApi(txRawBytes []byte) (string, error) {
return "", fmt.Errorf("failed to create request: %s", err)
}
req.Header.Add("Content-Type", "application/cbor")
if cfg.Submit.BlockFrostProjectID != "" {
req.Header.Add("project_id", cfg.Submit.BlockFrostProjectID)
}
client := &http.Client{Timeout: 5 * time.Minute}
resp, err := client.Do(req)
if err != nil {
Expand Down
Loading