-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathconfig.go
More file actions
38 lines (33 loc) · 951 Bytes
/
config.go
File metadata and controls
38 lines (33 loc) · 951 Bytes
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 controller
import (
"strings"
)
const (
// TmplNS is the meta variable for the k8s namespace.
TmplNS = "{{namespace}}"
// TmplDN is the meta variable for the k8s deployment name.
TmplDN = "{{deploymentName}}"
// TmplCN is the meta variable for the container name.
TmplCN = "{{containerName}}"
)
// Config holds the global configuration for the controller.
type Config struct {
Template string
LogicalEnvironment string
PhysicalEnvironment string
Cluster string
APIToken string
BaseURL string
GHAppID string
GHInstallID string
GHAppPrivateKey string
Organization string
}
// ValidTemplate verifies that at least one placeholder is present
// in the provided template t.
func ValidTemplate(t string) bool {
hasPlaceholder := strings.Contains(t, TmplNS) ||
strings.Contains(t, TmplDN) ||
strings.Contains(t, TmplCN)
return hasPlaceholder
}