this repo has no description
1package server
2
3import "git.xeserv.us/Techaro/hythlodaeus/telemetry"
4
5type config struct {
6 grpcBind string
7 grpcCert string
8 grpcKey string
9 grpcInsecure bool
10 httpBind string
11 httpsBind string
12 proxyProto bool
13 telemetryConfig telemetry.Config
14}
15
16func defaultConfig() *config {
17 return &config{
18 grpcBind: ":8393",
19 grpcInsecure: false,
20 grpcCert: "",
21 grpcKey: "",
22 httpBind: ":80",
23 httpsBind: ":443",
24 proxyProto: false,
25 }
26}
27
28// An Option modifies the config.
29type Option func(*config)
30
31func WithGRPCBind(grpcBind string) Option {
32 return func(cfg *config) {
33 cfg.grpcBind = grpcBind
34 }
35}
36
37func WithGRPCCert(grpcCert string) Option {
38 return func(cfg *config) {
39 cfg.grpcCert = grpcCert
40 }
41}
42
43func WithGRPCKey(grpcKey string) Option {
44 return func(cfg *config) {
45 cfg.grpcKey = grpcKey
46 }
47}
48
49func WithGRPCInsecure(val bool) Option {
50 return func(cfg *config) {
51 cfg.grpcInsecure = val
52 }
53}
54
55func WithHTTPBind(httpBind string) Option {
56 return func(cfg *config) {
57 cfg.httpBind = httpBind
58 }
59}
60
61func WithHTTPSBind(httpsBind string) Option {
62 return func(cfg *config) {
63 cfg.httpsBind = httpsBind
64 }
65}
66
67func WithProxyProto(proxyProto bool) Option {
68 return func(cfg *config) {
69 cfg.proxyProto = proxyProto
70 }
71}
72
73func WithTelemetryConfig(tcfg telemetry.Config) Option {
74 return func(cfg *config) {
75 cfg.telemetryConfig = tcfg
76 }
77}