-
Notifications
You must be signed in to change notification settings - Fork 72
/
templates.go
53 lines (48 loc) · 1.68 KB
/
templates.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
package generate
import (
"github.com/MakeNowJust/heredoc"
"github.com/redhat-developer/app-services-cli/pkg/cmd/registry/registrycmdutil"
)
var (
templateEnv = heredoc.Doc(`
## Generated by rhoas cli
{{if .KafkaHost}}## Kafka Configuration
KAFKA_HOST={{.KafkaHost}}
{{end}}{{if .RegistryURL}}## Service Registry Configuration
SERVICE_REGISTRY_URL={{.RegistryURL}}
SERVICE_REGISTRY_CORE_PATH=` + registrycmdutil.REGISTRY_CORE_PATH + `
SERVICE_REGISTRY_COMPAT_PATH=` + registrycmdutil.REGISTRY_COMPAT_PATH + `
{{end}}
`)
templateJSON = heredoc.Doc(`
{
{{if .KafkaHost}}"kafkaHost":"{{.KafkaHost}}",
{{end}}{{if .RegistryURL}}"serviceRegistryUrl":"{{.RegistryURL}}",
"serviceRegistryCorePath":"` + registrycmdutil.REGISTRY_CORE_PATH + `",
"serviceRegistryCompatPath":"` + registrycmdutil.REGISTRY_COMPAT_PATH + `"{{end}}
}
`)
templateProperties = heredoc.Doc(`
## Generated by rhoas cli
{{if .KafkaHost}}## Kafka Configuration
kafkaHost={{.KafkaHost}}
{{end}}{{if .RegistryURL}}## Service Registry Configuration
serviceRegistryUrl={{.RegistryURL}}
serviceRegistryCorePath=` + registrycmdutil.REGISTRY_CORE_PATH + `
serviceRegistryCompatPath=` + registrycmdutil.REGISTRY_COMPAT_PATH + `{{end}}
`)
templateConfigMap = heredoc.Doc(`
apiVersion: v1
kind: ConfigMap
metadata:
name: {{.Name}}
data:
{{if .KafkaHost}}## Kafka Configuration
kafka_host: {{.KafkaHost}}
{{end}}
{{if .RegistryURL}}## Service Registry Configuration
service_registry_url: {{.RegistryURL}}
service_registry_compat_path: ` + registrycmdutil.REGISTRY_COMPAT_PATH + `
service_registry_core_path: ` + registrycmdutil.REGISTRY_CORE_PATH + `{{end}}
`)
)