-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
36 lines (32 loc) · 963 Bytes
/
main.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
package main
import (
"context"
"flag"
"log"
"github.com/dvordrova/go-server-template/server"
"github.com/dvordrova/go-server-template/utils"
"github.com/go-fuego/fuego"
)
func main() {
addrFlag := flag.String("address", "localhost:8080", "address to listen on")
basePathFlag := flag.String("base-path", "", "base path for the server")
traceEndpointFlag := flag.String("trace-endpoint", "", "trace endpoint")
proxyEndpointFlag := flag.String("proxy-endpoint", "", "proxy endpoint")
flag.Parse()
ctx := context.Background()
shutdown, err := utils.SetupOTelSDK(ctx, *traceEndpointFlag)
if err != nil {
log.Fatalf("failed to setup OpenTelemetry SDK: %v", err)
}
defer func() { _ = shutdown(ctx) }()
handler := server.Handler{}
server.InitHandler(&handler)
server.ReinitHandler(&handler)
server.NewServer(
&handler,
"go-server-template",
*proxyEndpointFlag,
fuego.WithAddr(*addrFlag),
fuego.WithBasePath(*basePathFlag),
).Run()
}