From 7bb966636323926e04b64ebd398fedbedf0b0fdf Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Wed, 6 Sep 2023 15:18:34 -0700 Subject: [PATCH 1/3] post-refactor, cors flag was not being used --- packages/relayer/cmd/flags/common.go | 10 ---------- packages/relayer/cmd/flags/indexer.go | 8 ++++++++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/relayer/cmd/flags/common.go b/packages/relayer/cmd/flags/common.go index b98443d4702..2bb7d15fcca 100644 --- a/packages/relayer/cmd/flags/common.go +++ b/packages/relayer/cmd/flags/common.go @@ -128,16 +128,6 @@ var ( } ) -// optional -var ( - CORSOrigins = &cli.StringFlag{ - Name: "http.corsOrigins", - Usage: "Comma-delinated list of cors origins", - Required: false, - Category: commonCategory, - } -) - // All common flags. var CommonFlags = []cli.Flag{ // required diff --git a/packages/relayer/cmd/flags/indexer.go b/packages/relayer/cmd/flags/indexer.go index f4c6c1540be..26cfd7cfd2f 100644 --- a/packages/relayer/cmd/flags/indexer.go +++ b/packages/relayer/cmd/flags/indexer.go @@ -68,6 +68,13 @@ var ( Value: 4102, EnvVars: []string{"HTTP_PORT"}, } + CORSOrigins = &cli.StringFlag{ + Name: "http.corsOrigins", + Usage: "Comma-delinated list of cors origins", + Required: false, + Value: "*", + Category: commonCategory, + } ) var IndexerFlags = MergeFlags(CommonFlags, []cli.Flag{ @@ -80,4 +87,5 @@ var IndexerFlags = MergeFlags(CommonFlags, []cli.Flag{ SubscriptionBackoff, SyncMode, WatchMode, + CORSOrigins, }) From 4df031c41e05748b4427d7e14a07c4ce931dcb3b Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Wed, 6 Sep 2023 15:19:11 -0700 Subject: [PATCH 2/3] test --- packages/relayer/indexer/config_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/relayer/indexer/config_test.go b/packages/relayer/indexer/config_test.go index 610e2bce514..4386eb8e380 100644 --- a/packages/relayer/indexer/config_test.go +++ b/packages/relayer/indexer/config_test.go @@ -47,6 +47,7 @@ func TestNewConfigFromCliContext(t *testing.T) { assert.Equal(t, common.HexToAddress(destBridgeAddr), c.DestBridgeAddress) assert.Equal(t, common.HexToAddress(srcBridgeAddr), c.SrcBridgeAddress) assert.Equal(t, common.HexToAddress(srcTaikoAddr), c.SrcTaikoAddress) + assert.Equal(t, "*", c.CORSOrigins) c.OpenDBFunc = func() (DB, error) { return &mock.DB{}, nil @@ -76,5 +77,6 @@ func TestNewConfigFromCliContext(t *testing.T) { "-" + flags.DestBridgeAddress.Name, destBridgeAddr, "-" + flags.SrcBridgeAddress.Name, srcBridgeAddr, "-" + flags.SrcTaikoAddress.Name, srcTaikoAddr, + "-" + flags.CORSOrigins.Name, "*", })) } From b66ed4f2111cf5c1cb92b4fbb7e8d0a46dbb32e1 Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Wed, 6 Sep 2023 15:19:28 -0700 Subject: [PATCH 3/3] test --- packages/relayer/indexer/config_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/relayer/indexer/config_test.go b/packages/relayer/indexer/config_test.go index 4386eb8e380..5956bca61bf 100644 --- a/packages/relayer/indexer/config_test.go +++ b/packages/relayer/indexer/config_test.go @@ -47,7 +47,7 @@ func TestNewConfigFromCliContext(t *testing.T) { assert.Equal(t, common.HexToAddress(destBridgeAddr), c.DestBridgeAddress) assert.Equal(t, common.HexToAddress(srcBridgeAddr), c.SrcBridgeAddress) assert.Equal(t, common.HexToAddress(srcTaikoAddr), c.SrcTaikoAddress) - assert.Equal(t, "*", c.CORSOrigins) + assert.Equal(t, []string{"*"}, c.CORSOrigins) c.OpenDBFunc = func() (DB, error) { return &mock.DB{}, nil