forked from Peripli/service-broker-proxy-cf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
38 lines (29 loc) · 833 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
package main
import (
"context"
"fmt"
"github.com/Peripli/service-broker-proxy-cf/cf"
"github.com/Peripli/service-broker-proxy/pkg/sbproxy"
"github.com/spf13/pflag"
)
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
env := sbproxy.DefaultEnv(func(set *pflag.FlagSet) {
cf.CreatePFlagsForCFClient(set)
})
if err := cf.SetCFOverrides(env); err != nil {
panic(fmt.Errorf("error setting CF environment values: %s", err))
}
platformConfig, err := cf.NewConfig(env)
if err != nil {
panic(fmt.Errorf("error loading config: %s", err))
}
platformClient, err := cf.NewClient(platformConfig)
if err != nil {
panic(fmt.Errorf("error creating CF client: %s", err))
}
proxyBuilder := sbproxy.New(ctx, cancel, env, platformClient)
proxy := proxyBuilder.Build()
proxy.Run()
}