-
Notifications
You must be signed in to change notification settings - Fork 229
/
types.go
44 lines (36 loc) · 847 Bytes
/
types.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
package cueutil
type EnvType string
const (
EnvType_Production EnvType = "production"
EnvType_Development EnvType = "development"
EnvType_Ephemeral EnvType = "ephemeral"
EnvType_Test EnvType = "test"
)
type CloudType string
const (
CloudType_AWS CloudType = "aws"
CloudType_Azure CloudType = "azure"
CloudType_GCP CloudType = "gcp"
CloudType_Encore CloudType = "encore"
CloudType_Local CloudType = "local"
)
type Meta struct {
APIBaseURL string
EnvName string
EnvType EnvType
CloudType CloudType
}
func (m *Meta) ToTags() []string {
if m == nil {
return nil
}
return []string{
tag("APIBaseURL", m.APIBaseURL),
tag("EnvName", m.EnvName),
tag("EnvType", m.EnvType),
tag("CloudType", m.CloudType),
}
}
func tag[T ~string](name string, value T) string {
return name + "=" + string(value)
}