Skip to content

Commit b13c4ce

Browse files
authored
Mount clue HTTP request log middleware (#3550)
* Mount clue HTTP request log middleware in generated examples * Update dependencies * Set minimum Go version to 1.21 This is needed because of the change in the go.mod syntax With 1.21 the go version must include a minor version or the toolchain version must be specified. See https://tip.golang.org/doc/go1.21 'Tools' section * Upgrade all dependencies * Implement proper test concurrency Make sure test gRPC handler is running before cancelling the context So the stream canceler properly records the context cancel function.
1 parent c6dc4dc commit b13c4ce

10 files changed

+64
-43
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: true
1515
matrix:
16-
go: ['1.20', '1.21', '1.22']
16+
go: ['1.21', '1.22']
1717
os: ['ubuntu-latest', 'windows-latest']
1818
runs-on: ${{ matrix.os }}
1919

go.mod

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module goa.design/goa/v3
22

3-
go 1.20
3+
go 1.21.0
44

55
require (
66
github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598
7-
github.com/getkin/kin-openapi v0.125.0
7+
github.com/getkin/kin-openapi v0.126.0
88
github.com/go-chi/chi/v5 v5.1.0
99
github.com/google/uuid v1.6.0
1010
github.com/gorilla/websocket v1.5.3
@@ -13,26 +13,26 @@ require (
1313
github.com/sergi/go-diff v1.3.1
1414
github.com/stretchr/testify v1.9.0
1515
golang.org/x/text v0.16.0
16-
golang.org/x/tools v0.22.0
17-
google.golang.org/grpc v1.64.0
16+
golang.org/x/tools v0.23.0
17+
google.golang.org/grpc v1.65.0
1818
google.golang.org/protobuf v1.34.2
1919
gopkg.in/yaml.v3 v3.0.1
2020
)
2121

2222
require (
2323
github.com/davecgh/go-spew v1.1.1 // indirect
24-
github.com/go-openapi/jsonpointer v0.20.2 // indirect
25-
github.com/go-openapi/swag v0.22.8 // indirect
26-
github.com/invopop/yaml v0.2.0 // indirect
24+
github.com/go-openapi/jsonpointer v0.21.0 // indirect
25+
github.com/go-openapi/swag v0.23.0 // indirect
26+
github.com/invopop/yaml v0.3.1 // indirect
2727
github.com/josharian/intern v1.0.0 // indirect
2828
github.com/mailru/easyjson v0.7.7 // indirect
2929
github.com/manveru/gobdd v0.0.0-20131210092515-f1a17fdd710b // indirect
3030
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
3131
github.com/perimeterx/marshmallow v1.1.5 // indirect
3232
github.com/pmezard/go-difflib v1.0.0 // indirect
33-
golang.org/x/mod v0.18.0 // indirect
34-
golang.org/x/net v0.26.0 // indirect
33+
golang.org/x/mod v0.19.0 // indirect
34+
golang.org/x/net v0.27.0 // indirect
3535
golang.org/x/sync v0.7.0 // indirect
36-
golang.org/x/sys v0.21.0 // indirect
36+
golang.org/x/sys v0.22.0 // indirect
3737
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
3838
)

go.sum

+25-19
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,33 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
33
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
44
github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598 h1:MGKhKyiYrvMDZsmLR/+RGffQSXwEkXgfLSA08qDn9AI=
55
github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598/go.mod h1:0FpDmbrt36utu8jEmeU05dPC9AB5tsLYVVi+ZHfyuwI=
6-
github.com/getkin/kin-openapi v0.125.0 h1:jyQCyf2qXS1qvs2U00xQzkGCqYPhEhZDmSmVt65fXno=
7-
github.com/getkin/kin-openapi v0.125.0/go.mod h1:wb1aSZA/iWmorQP9KTAS/phLj/t17B5jT7+fS8ed9NM=
6+
github.com/getkin/kin-openapi v0.126.0 h1:c2cSgLnAsS0xYfKsgt5oBV6MYRM/giU8/RtwUY4wyfY=
7+
github.com/getkin/kin-openapi v0.126.0/go.mod h1:7mONz8IwmSRg6RttPu6v8U/OJ+gr+J99qSFNjPGSQqw=
88
github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw=
99
github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
10-
github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q=
11-
github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs=
12-
github.com/go-openapi/swag v0.22.8 h1:/9RjDSQ0vbFR+NyjGMkFTsA1IA0fmhKSThmfGZjicbw=
13-
github.com/go-openapi/swag v0.22.8/go.mod h1:6QT22icPLEqAM/z/TChgb4WAveCHF92+2gF0CNjHpPI=
10+
github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ=
11+
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
12+
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
13+
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
1414
github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM=
15+
github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
1516
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
17+
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
1618
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
1719
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
1820
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
1921
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
20-
github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY=
21-
github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q=
22+
github.com/invopop/yaml v0.3.1 h1:f0+ZpmhfBSS4MhG+4HYseMdJhoeeopbSKbq5Rpeelso=
23+
github.com/invopop/yaml v0.3.1/go.mod h1:PMOp3nn4/12yEZUFfmOuNHJsZToEEOwoWsT+D81KkeA=
2224
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
2325
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
2426
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
2527
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
28+
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
2629
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
2730
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
2831
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
32+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
2933
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
3034
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
3135
github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d h1:Zj+PHjnhRYWBK6RqCDBcAhLXoi3TzC27Zad/Vn+gnVQ=
@@ -41,36 +45,38 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
4145
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4246
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
4347
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
48+
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
4449
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
4550
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
4651
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
4752
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
4853
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
4954
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
5055
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
51-
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
52-
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
53-
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
54-
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
56+
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
57+
golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8=
58+
golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
59+
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
60+
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
5561
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
5662
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
57-
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
58-
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
63+
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
64+
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
5965
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
6066
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
61-
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
62-
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
67+
golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg=
68+
golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI=
6369
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA=
6470
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY=
65-
google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY=
66-
google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg=
71+
google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
72+
google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=
6773
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
6874
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
6975
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
7076
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
7177
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
78+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
7279
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
7380
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
74-
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
7581
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
7682
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

grpc/middleware/canceler_test.go

+22-13
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package middleware_test
22

33
import (
44
"context"
5+
"sync"
56
"testing"
67

78
"github.com/stretchr/testify/assert"
@@ -23,24 +24,30 @@ func TestStreamCanceler(t *testing.T) {
2324
}
2425
)
2526
cases := []struct {
26-
name string
27-
stream grpc.ServerStream
28-
handler grpc.StreamHandler
27+
name string
28+
stream grpc.ServerStream
29+
handlerFunc func(wg *sync.WaitGroup) grpc.StreamHandler
2930
}{
3031
{
3132
name: "handler canceled",
3233
stream: grpcm.NewWrappedServerStream(context.Background(), &testCancelerStream{}),
33-
handler: func(srv any, stream grpc.ServerStream) error {
34-
<-stream.Context().Done() // block until canceled
35-
return nil
34+
handlerFunc: func(wg *sync.WaitGroup) grpc.StreamHandler {
35+
return func(srv any, stream grpc.ServerStream) error {
36+
wg.Done()
37+
<-stream.Context().Done() // block until canceled
38+
return nil
39+
}
3640
},
3741
},
3842
{
3943
name: "handler not canceled",
4044
stream: grpcm.NewWrappedServerStream(context.Background(), &testCancelerStream{}),
41-
handler: func(srv any, stream grpc.ServerStream) error {
42-
// don't block, finish before being canceled
43-
return nil
45+
handlerFunc: func(wg *sync.WaitGroup) grpc.StreamHandler {
46+
return func(srv any, stream grpc.ServerStream) error {
47+
wg.Done()
48+
// don't block, finish before being canceled
49+
return nil
50+
}
4451
},
4552
},
4653
}
@@ -49,11 +56,13 @@ func TestStreamCanceler(t *testing.T) {
4956
t.Run(c.name, func(t *testing.T) {
5057
ctx, cancel := context.WithCancel(context.Background())
5158
interceptor := grpcm.StreamCanceler(ctx)
59+
var wg sync.WaitGroup
60+
wg.Add(1)
61+
go func(t *testing.T) {
62+
assert.NoError(t, interceptor(nil, c.stream, stream, c.handlerFunc(&wg)))
63+
}(t)
64+
wg.Wait()
5265
cancel()
53-
err := interceptor(nil, c.stream, stream, c.handler)
54-
if err != nil {
55-
assert.ErrorContains(t, err, "server is stopping")
56-
}
5766
})
5867
}
5968
}

http/codegen/templates/server_middleware.go.tpl

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
// Log query and response bodies if debug logs are enabled.
55
handler = debug.HTTP()(handler)
66
}
7+
handler = log.HTTP(ctx)(handler)

http/codegen/testdata/server-no-server.golden

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL, serviceEndpoints *service
4444
// Log query and response bodies if debug logs are enabled.
4545
handler = debug.HTTP()(handler)
4646
}
47+
handler = log.HTTP(ctx)(handler)
4748

4849
// Start HTTP server using default configuration, change the code to
4950
// configure the server as required by your service.

http/codegen/testdata/server-server-hosting-multiple-services.golden

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL, serviceEndpoints *service
4747
// Log query and response bodies if debug logs are enabled.
4848
handler = debug.HTTP()(handler)
4949
}
50+
handler = log.HTTP(ctx)(handler)
5051

5152
// Start HTTP server using default configuration, change the code to
5253
// configure the server as required by your service.

http/codegen/testdata/server-server-hosting-service-subset.golden

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL, serviceEndpoints *service
4444
// Log query and response bodies if debug logs are enabled.
4545
handler = debug.HTTP()(handler)
4646
}
47+
handler = log.HTTP(ctx)(handler)
4748

4849
// Start HTTP server using default configuration, change the code to
4950
// configure the server as required by your service.

http/codegen/testdata/server-server-hosting-service-with-file-server.golden

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL, wg *sync.WaitGroup, errc
4444
// Log query and response bodies if debug logs are enabled.
4545
handler = debug.HTTP()(handler)
4646
}
47+
handler = log.HTTP(ctx)(handler)
4748

4849
// Start HTTP server using default configuration, change the code to
4950
// configure the server as required by your service.

http/codegen/testdata/server-streaming.golden

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func handleHTTPServer(ctx context.Context, u *url.URL, streamingServiceAEndpoint
4848
// Log query and response bodies if debug logs are enabled.
4949
handler = debug.HTTP()(handler)
5050
}
51+
handler = log.HTTP(ctx)(handler)
5152

5253
// Start HTTP server using default configuration, change the code to
5354
// configure the server as required by your service.

0 commit comments

Comments
 (0)