Skip to content

Commit

Permalink
fix(relayer): Relayer cors flag was not being used (#14661)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Sep 7, 2023
1 parent 15b0e50 commit 19f35f7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 0 additions & 10 deletions packages/relayer/cmd/flags/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions packages/relayer/cmd/flags/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -80,4 +87,5 @@ var IndexerFlags = MergeFlags(CommonFlags, []cli.Flag{
SubscriptionBackoff,
SyncMode,
WatchMode,
CORSOrigins,
})
2 changes: 2 additions & 0 deletions packages/relayer/indexer/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -76,5 +77,6 @@ func TestNewConfigFromCliContext(t *testing.T) {
"-" + flags.DestBridgeAddress.Name, destBridgeAddr,
"-" + flags.SrcBridgeAddress.Name, srcBridgeAddr,
"-" + flags.SrcTaikoAddress.Name, srcTaikoAddr,
"-" + flags.CORSOrigins.Name, "*",
}))
}

0 comments on commit 19f35f7

Please sign in to comment.