Skip to content

Commit 68532d5

Browse files
authored
Merge pull request #184 from nginxinc/missing-secret-message
Return an meaningful error when there is no cert and key for the default server
2 parents 8be9aa1 + 1054fe7 commit 68532d5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

nginx-controller/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var (
4848
defaultServerSecret = flag.String("default-server-tls-secret", "",
4949
`Specifies a secret with a TLS certificate and key for SSL termination of
5050
the default server. The value must follow the following format: <namespace>/<name>.
51-
If not specified, the key and the cert from /etc/nginx/default is used.`)
51+
If not specified, the key and the cert from /etc/nginx/secrets/default is used.`)
5252
)
5353

5454
func main() {
@@ -107,6 +107,11 @@ func main() {
107107

108108
bytes := nginx.GenerateCertAndKeyFileContent(secret)
109109
ngxc.AddOrUpdateSecretFile(nginx.DefaultServerSecretName, bytes, nginx.TLSSecretFileMode)
110+
} else {
111+
_, err = os.Stat("/etc/nginx/secrets/default")
112+
if os.IsNotExist(err) {
113+
glog.Fatalf("A TLS cert and key for the default server is not found")
114+
}
110115
}
111116

112117
nginxDone := make(chan error, 1)

0 commit comments

Comments
 (0)