-
Notifications
You must be signed in to change notification settings - Fork 280
/
helpers.go
92 lines (84 loc) · 2.16 KB
/
helpers.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package config
const (
// ServiceAll represents running all services in "all-in-one" mode
ServiceAll = "all"
// ServiceProxy represents running the proxy service component
ServiceProxy = "proxy"
// ServiceAuthorize represents running the authorize service component
ServiceAuthorize = "authorize"
// ServiceAuthenticate represents running the authenticate service component
ServiceAuthenticate = "authenticate"
// ServiceCache represents running the cache service component
ServiceCache = "cache"
// ServiceDataBroker represents running the databroker service component
ServiceDataBroker = "databroker"
// StorageRedisName is the name of the redis storage backend
StorageRedisName = "redis"
// StoragePostgresName is the name of the Postgres storage backend
StoragePostgresName = "postgres"
// StorageInMemoryName is the name of the in-memory storage backend
StorageInMemoryName = "memory"
)
// IsValidService checks to see if a service is a valid service mode
func IsValidService(s string) bool {
switch s {
case
ServiceAll,
ServiceAuthenticate,
ServiceAuthorize,
ServiceCache,
ServiceDataBroker,
ServiceProxy:
return true
}
return false
}
// IsAuthenticate checks to see if we should be running the authenticate service
func IsAuthenticate(s string) bool {
switch s {
case
ServiceAll,
ServiceAuthenticate:
return true
}
return false
}
// IsAuthorize checks to see if we should be running the authorize service
func IsAuthorize(s string) bool {
switch s {
case
ServiceAll,
ServiceAuthorize:
return true
}
return false
}
// IsProxy checks to see if we should be running the proxy service
func IsProxy(s string) bool {
switch s {
case
ServiceAll,
ServiceProxy:
return true
}
return false
}
// IsDataBroker checks to see if we should be running the databroker service
func IsDataBroker(s string) bool {
switch s {
case
ServiceAll,
ServiceCache,
ServiceDataBroker:
return true
}
return false
}
// IsRegistry checks if this node should run the registry service
func IsRegistry(s string) bool {
return IsDataBroker(s)
}
// IsAll checks to see if we should be running all services
func IsAll(s string) bool {
return s == ServiceAll
}