Skip to content

Commit

Permalink
Return an meaningful error when there is no cert and key for the defa…
Browse files Browse the repository at this point in the history
…ult server
  • Loading branch information
pleshakov committed Sep 6, 2017
1 parent 8be9aa1 commit 1054fe7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nginx-controller/main.go
Original file line number Diff line number Diff line change
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 1054fe7

Please sign in to comment.