From 5cc06e39bc7e0f521b6ccdbce57d69823cd9897a Mon Sep 17 00:00:00 2001 From: Shishir Pai <64056966+mgpai22@users.noreply.github.com> Date: Mon, 8 Jul 2024 13:16:36 +0000 Subject: [PATCH 1/3] add api key support for submit url --- internal/config/config.go | 1 + internal/tx/tx.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/internal/config/config.go b/internal/config/config.go index cc69d2b..f4e1091 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -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 { diff --git a/internal/tx/tx.go b/internal/tx/tx.go index 749f39e..f012e56 100644 --- a/internal/tx/tx.go +++ b/internal/tx/tx.go @@ -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 { From d50ce22fa6308e3c1e77420fe9d4ee2c2bae227f Mon Sep 17 00:00:00 2001 From: Shishir Pai <64056966+mgpai22@users.noreply.github.com> Date: Mon, 8 Jul 2024 13:45:19 +0000 Subject: [PATCH 2/3] make api key bf specific --- internal/config/config.go | 8 ++++---- internal/tx/tx.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index f4e1091..917aaee 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -47,10 +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"` - UrlKey string `yaml:"urlKey" envconfig:"SUBMIT_URL_KEY"` + 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 { diff --git a/internal/tx/tx.go b/internal/tx/tx.go index f012e56..b002416 100644 --- a/internal/tx/tx.go +++ b/internal/tx/tx.go @@ -486,8 +486,8 @@ 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) + if cfg.Submit.BlockFrostProjectID != "" { + req.Header.Add("project_id", cfg.Submit.BlockFrostProjectID) } client := &http.Client{Timeout: 5 * time.Minute} resp, err := client.Do(req) From 36d7e60ae9679a04d14f505c923bf4cc94d7198d Mon Sep 17 00:00:00 2001 From: Shishir Pai <64056966+mgpai22@users.noreply.github.com> Date: Tue, 9 Jul 2024 01:15:20 +0000 Subject: [PATCH 3/3] fix typo --- internal/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/config/config.go b/internal/config/config.go index 917aaee..c00c1b7 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -50,7 +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"` - BlockFrostProjectID string `yaml:"blockFrostProjectID"` envconfig:"SUBMIT_BLOCKFROST_PROJECT_ID"` + BlockFrostProjectID string `yaml:"blockFrostProjectID" envconfig:"SUBMIT_BLOCKFROST_PROJECT_ID"` } type StorageConfig struct {