forked from kyma-project/kyma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
51 lines (45 loc) · 1.77 KB
/
options.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
package main
import (
"flag"
"fmt"
)
type options struct {
externalAPIPort int
proxyPort int
application string
namespace string
requestTimeout int
skipVerify bool
proxyTimeout int
requestLogging bool
proxyCacheTTL int
}
func parseArgs() *options {
externalAPIPort := flag.Int("externalAPIPort", 8081, "External API port.")
proxyPort := flag.Int("proxyPort", 8080, "Proxy port.")
application := flag.String("application", "default-ec", "Application name for reading and updating services.")
namespace := flag.String("namespace", "kyma-system", "Namespace used by the Application Gateway")
requestTimeout := flag.Int("requestTimeout", 1, "Timeout for services.")
skipVerify := flag.Bool("skipVerify", false, "Flag for skipping certificate verification for proxy target.")
proxyTimeout := flag.Int("proxyTimeout", 10, "Timeout for proxy call.")
requestLogging := flag.Bool("requestLogging", false, "Flag for logging incoming requests.")
proxyCacheTTL := flag.Int("proxyCacheTTL", 120, "TTL, in seconds, for proxy cache of Remote API information")
flag.Parse()
return &options{
externalAPIPort: *externalAPIPort,
proxyPort: *proxyPort,
application: *application,
namespace: *namespace,
requestTimeout: *requestTimeout,
skipVerify: *skipVerify,
proxyTimeout: *proxyTimeout,
requestLogging: *requestLogging,
proxyCacheTTL: *proxyCacheTTL,
}
}
func (o *options) String() string {
return fmt.Sprintf("--externalAPIPort=%d --proxyPort=%d --application=%s --namespace=%s --requestTimeout=%d --skipVerify=%v --proxyTimeout=%d"+
" --requestLogging=%t --proxyCacheTTL=%d",
o.externalAPIPort, o.proxyPort, o.application, o.namespace, o.requestTimeout, o.skipVerify, o.proxyTimeout,
o.requestLogging, o.proxyCacheTTL)
}