Skip to content

Commit

Permalink
Gateway enabled by default
Browse files Browse the repository at this point in the history
In readiness for the Beta release, set the ‘Enabled’ config option of the gateway to ‘true’.
All peers will now have the gateway server enabled unless it is explicitly disbaled.

Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
  • Loading branch information
andrew-coleman authored and denyeart committed Jul 28, 2021
1 parent 5331bbc commit 87ea070
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 7 deletions.
2 changes: 0 additions & 2 deletions integration/gateway/endorsing_orgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ var _ = Describe("GatewayService with endorsing orgs", func() {
config := nwo.ThreeOrgRaft()
network = nwo.New(config, testDir, client, StartPort(), components)

network.GatewayEnabled = true

network.GenerateConfigTree()
network.Bootstrap()

Expand Down
2 changes: 0 additions & 2 deletions integration/gateway/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ var _ = Describe("GatewayService", func() {
config := nwo.BasicEtcdRaft()
network = nwo.New(config, testDir, client, StartPort(), components)

network.GatewayEnabled = true

network.GenerateConfigTree()
network.Bootstrap()

Expand Down
4 changes: 2 additions & 2 deletions integration/nwo/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ func New(c *Config, rootDir string, dockerClient *docker.Client, startPort int,
Profiles: c.Profiles,
Consortiums: c.Consortiums,
Templates: c.Templates,
TLSEnabled: true, // Set TLS enabled as true for default
GatewayEnabled: false, // Set Gateway enabled as false for default
TLSEnabled: true, // Set TLS enabled as true for default
GatewayEnabled: true, // Set Gateway enabled as true for default

mutex: &sync.Mutex{},
lastExecuted: make(map[string]time.Time),
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/gateway/config/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Options struct {
}

var defaultOptions = Options{
Enabled: false,
Enabled: true,
EndorsementTimeout: 10 * time.Second,
DialTimeout: 30 * time.Second,
}
Expand Down
20 changes: 20 additions & 0 deletions internal/pkg/gateway/config/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ peer:
dialTimeout: 2m
`)

var testConfigOff = []byte(`
peer:
gateway:
enabled: false
`)

func TestDefaultOptions(t *testing.T) {
v := viper.New()
options := GetOptions(v)
Expand All @@ -42,3 +48,17 @@ func TestOverriddenOptions(t *testing.T) {
}
require.Equal(t, expectedOptions, options)
}

func TestDisabledGatewayOption(t *testing.T) {
v := viper.New()
v.SetConfigType("yaml")
v.ReadConfig(bytes.NewBuffer(testConfigOff))
options := GetOptions(v)

expectedOptions := Options{
Enabled: false,
EndorsementTimeout: 10 * time.Second,
DialTimeout: 30 * time.Second,
}
require.Equal(t, expectedOptions, options)
}
12 changes: 12 additions & 0 deletions sampleconfig/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ peer:
# When set to true, will override peer address.
addressAutoDetect: false

# Settings for the Peer's gateway server.
gateway:
# Whether the gateway is enabled for this Peer.
enabled: true
# endorsementTimeout is the duration the gateway waits for a response
# from other endorsing peers before returning a timeout error to the client.
endorsementTimeout: 30s
# dialTimeout is the duration the gateway waits for a connection
# to other network nodes.
dialTimeout: 2m


# Keepalive settings for peer server and clients
keepalive:
# Interval is the duration after which if the server does not see
Expand Down

0 comments on commit 87ea070

Please sign in to comment.