Skip to content

Commit cacfe04

Browse files
Skip downloading the cert if tinkServerTLS is not enabled
1 parent 00dade0 commit cacfe04

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

hook-docker/main.go

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ import (
1313
)
1414

1515
type tinkConfig struct {
16-
registry string
17-
baseURL string
18-
tinkerbell string
19-
syslogHost string
16+
registry string
17+
baseURL string
18+
tinkerbell string
19+
syslogHost string
20+
tinkServerTLS bool
2021

2122
// TODO add others
2223
}
@@ -39,19 +40,22 @@ func main() {
3940
cmdLines := strings.Split(string(content), " ")
4041
cfg := parseCmdLine(cmdLines)
4142

42-
path := fmt.Sprintf("/etc/docker/certs.d/%s/", cfg.registry)
43+
// if tinkServerTLS is not enabled, skip downloading the certs
44+
if cfg.tinkServerTLS {
45+
path := fmt.Sprintf("/etc/docker/certs.d/%s/", cfg.registry)
4346

44-
// Create the directory
45-
err = os.MkdirAll(path, os.ModeDir)
46-
if err != nil {
47-
panic(err)
48-
}
49-
// Download the configuration
50-
err = downloadFile(path+"ca.crt", cfg.baseURL+"/ca.pem")
51-
if err != nil {
52-
panic(err)
47+
// Create the directory
48+
err = os.MkdirAll(path, os.ModeDir)
49+
if err != nil {
50+
panic(err)
51+
}
52+
// Download the configuration
53+
err = downloadFile(path+"ca.crt", cfg.baseURL+"/ca.pem")
54+
if err != nil {
55+
panic(err)
56+
}
57+
fmt.Println("Downloaded the repository certificates, starting the Docker Engine")
5358
}
54-
fmt.Println("Downloaded the repository certificates, starting the Docker Engine")
5559

5660
d := dockerConfig{
5761
Debug: true,

0 commit comments

Comments
 (0)