Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(relayer): Relayer cors flag was not being used #14661

Merged
merged 3 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, "*",
}))
}
Loading