-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmain.go
42 lines (32 loc) · 980 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
package main
import (
"context"
"fmt"
"github.com/Peripli/service-broker-proxy-k8s/pkg/k8s/client"
"github.com/Peripli/service-broker-proxy-k8s/pkg/k8s/config"
"github.com/Peripli/service-broker-proxy/pkg/sbproxy"
"github.com/spf13/pflag"
)
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
env, err := sbproxy.DefaultEnv(ctx, func(set *pflag.FlagSet) {
config.CreatePFlagsForK8SClient(set)
})
if err != nil {
panic(fmt.Errorf("error creating environment: %s", err))
}
proxySettings, err := config.NewConfig(env)
if err != nil {
panic(fmt.Errorf("error loading config: %s", err))
}
platformClient, err := client.NewClient(proxySettings)
if err != nil {
panic(fmt.Errorf("error creating K8S client: %s", err))
}
proxyBuilder, err := sbproxy.New(ctx, cancel, env, &proxySettings.Settings, platformClient)
if err != nil {
panic(fmt.Errorf("error creating sbproxy: %s", err))
}
proxyBuilder.Build().Run()
}