Skip to content

Commit

Permalink
Merge pull request #184 from nginxinc/missing-secret-message
Browse files Browse the repository at this point in the history
Return an meaningful error when there is no cert and key for the default server
  • Loading branch information
pleshakov committed Sep 6, 2017
2 parents 8be9aa1 + 1054fe7 commit 68532d5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nginx-controller/main.go
Expand Up @@ -48,7 +48,7 @@ var (
defaultServerSecret = flag.String("default-server-tls-secret", "",
`Specifies a secret with a TLS certificate and key for SSL termination of
the default server. The value must follow the following format: <namespace>/<name>.
If not specified, the key and the cert from /etc/nginx/default is used.`)
If not specified, the key and the cert from /etc/nginx/secrets/default is used.`)
)

func main() {
Expand Down Expand Up @@ -107,6 +107,11 @@ func main() {

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

nginxDone := make(chan error, 1)
Expand Down

0 comments on commit 68532d5

Please sign in to comment.