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, }) diff --git a/packages/relayer/indexer/config_test.go b/packages/relayer/indexer/config_test.go index 610e2bce514..5956bca61bf 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, []string{"*"}, 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, "*", })) }