/
doc.go
74 lines (66 loc) · 1.82 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*This file is part of kuberpult.
Kuberpult is free software: you can redistribute it and/or modify
it under the terms of the Expat(MIT) License as published by
the Free Software Foundation.
Kuberpult is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MIT License for more details.
You should have received a copy of the MIT License
along with kuberpult. If not, see <https://directory.fsf.org/wiki/License:Expat>.
Copyright 2023 freiheit.com*/
/*
Server infrastructure common for all microservices in the project.
It contains the code that start and configures a HTTP and/or GRPC server
correctly.
*/
package setup
/*
Example:
func main() {
Run(ServerConfig{
GRPCProxy: &GRPCProxyConfig{
Port: "8000",
Register: func(mux *runtime.ServeMux) {
// Register your GRPC Proxy with gw.RegisterYourServiceHandlerFromEndpoint(grpcSrv, handler)
},
},
GRPC: &GRPCConfig{
Port: "10080",
Register: func(grpcSrv *grpc.Server) {
// Register your GRPC service with pb.RegisterXYServiceServer(grpcSrv, handler)
},
},
HTTP: []HTTPConfig{
{
Port: "5000",
Register: // register prometheus endpoint,
},
{
Port: "8080",
Register: // register health/live probes,
},
{
Port: "80",
Register: // register admin endpoints,
BasicAuth: // use basic auth to secure your admin endpoint
},
},
Background: []BackgroundTaskConfig{
{
Run: func(ctx context.Context) error {
// start pubsub import
return nil
},
Name: "Import Stuff",
Shutdown: func(ctx context.Context) error {
// shutdown pub/sub connection
},
},
},
Shutdown: func(ctx context.Context) error {
// close overarching connections (e.g. db or other stuff)
},
})
}
*/