Skip to content

Commit

Permalink
add api key support for submit url
Browse files Browse the repository at this point in the history
  • Loading branch information
mgpai22 committed Jul 8, 2024
1 parent c38a6b7 commit 5cc06e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ 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"`
UrlKey string `yaml:"urlKey" envconfig:"SUBMIT_URL_KEY"`
}

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.UrlKey != "" {
req.Header.Add("project_id", cfg.Submit.UrlKey)
}
client := &http.Client{Timeout: 5 * time.Minute}
resp, err := client.Do(req)
if err != nil {
Expand Down

0 comments on commit 5cc06e3

Please sign in to comment.