@@ -12,31 +12,27 @@ import (
12
12
13
13
// TLSTemplate TLS configuration
14
14
type TLSTemplate struct {
15
- RootDomain string
16
- Email string
17
- DNSService string
18
- ProjectID string
19
- IssuerType string
20
- Region string
21
- AccessKeyID string
22
- DigitalOceanAccessToken string
15
+ RootDomain string
16
+ Email string
17
+ DNSService string
18
+ ProjectID string
19
+ IssuerType string
20
+ Region string
21
+ AccessKeyID string
23
22
}
24
23
25
- var tlsTemplatesPath = "templates/k8s/tls/"
26
-
27
24
// Apply executes the plan
28
25
func Apply (plan types.Plan ) error {
29
26
30
27
tlsTemplatesList , _ := listTLSTemplates ()
31
28
tlsTemplate := TLSTemplate {
32
- RootDomain : plan .RootDomain ,
33
- Email : plan .TLSConfig .Email ,
34
- DNSService : plan .TLSConfig .DNSService ,
35
- ProjectID : plan .TLSConfig .ProjectID ,
36
- IssuerType : plan .TLSConfig .IssuerType ,
37
- Region : plan .TLSConfig .Region ,
38
- AccessKeyID : plan .TLSConfig .AccessKeyID ,
39
- DigitalOceanAccessToken : plan .TLSConfig .DigitalOceanAccessToken ,
29
+ RootDomain : plan .RootDomain ,
30
+ Email : plan .TLSConfig .Email ,
31
+ DNSService : plan .TLSConfig .DNSService ,
32
+ ProjectID : plan .TLSConfig .ProjectID ,
33
+ IssuerType : plan .TLSConfig .IssuerType ,
34
+ Region : plan .TLSConfig .Region ,
35
+ AccessKeyID : plan .TLSConfig .AccessKeyID ,
40
36
}
41
37
42
38
for _ , template := range tlsTemplatesList {
@@ -55,23 +51,17 @@ func Apply(plan types.Plan) error {
55
51
}
56
52
57
53
func listTLSTemplates () ([]string , error ) {
58
- file , err := os .Open (tlsTemplatesPath )
59
54
60
- if err != nil {
61
- log .Fatalf ("failed opening directory: %s, %s" , tlsTemplatesPath , err )
62
- return nil , err
63
- }
64
- defer file .Close ()
65
-
66
- list , _ := file .Readdirnames (0 )
67
- if err != nil {
68
- log .Fatalf ("failed reading filenames in directory %s, %s" , tlsTemplatesPath , err )
69
- return nil , err
70
- }
71
- return list , nil
55
+ return []string {
56
+ "issuer-prod.yml" ,
57
+ "issuer-staging.yml" ,
58
+ "wildcard-domain-cert.yml" ,
59
+ "auth-domain-cert.yml" ,
60
+ }, nil
72
61
}
73
62
74
63
func generateTemplate (fileName string , tlsTemplate TLSTemplate ) (string , error ) {
64
+ tlsTemplatesPath := "templates/k8s/tls/"
75
65
76
66
data , err := ioutil .ReadFile (tlsTemplatesPath + fileName )
77
67
if err != nil {
0 commit comments