-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
48 lines (41 loc) · 943 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
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"context"
"os"
"os/signal"
"github.com/rs/zerolog/log"
)
var config struct {
apiUserToken string
clusterID string
jwksEndpoint string
organizationID string
port string
}
func main() {
config.apiUserToken = os.Getenv("API_USER_TOKEN")
if config.apiUserToken == "" {
log.Fatal().Msg("API_USER_TOKEN is required")
}
config.clusterID = os.Getenv("CLUSTER_ID")
if config.clusterID == "" {
log.Fatal().Msg("CLUSTER_ID is required")
}
config.organizationID = os.Getenv("ORGANIZATION_ID")
if config.organizationID == "" {
log.Fatal().Msg("ORGANIZATION_ID is required")
}
config.port = os.Getenv("PORT")
if config.port == "" {
config.port = "8000"
}
ctx := context.Background()
ctx, stop := signal.NotifyContext(ctx, os.Interrupt)
defer stop()
if err := run(ctx); err != nil {
log.Fatal().Err(err).Send()
}
}
func run(ctx context.Context) error {
return serve(ctx)
}