diff --git a/pkg/certs/certs.go b/pkg/certs/certs.go index 8da9facf597..a4c27be8420 100644 --- a/pkg/certs/certs.go +++ b/pkg/certs/certs.go @@ -173,11 +173,21 @@ func NewConfigDirFromCtx(ctx *cli.Context, option string, getDefaultDir func() s } func getPublicCertFile() string { - return filepath.Join(GlobalCertsDir.Get(), PublicCertFile) + publicCertFile := filepath.Join(GlobalCertsDir.Get(), PublicCertFile) + TLSCertFile := filepath.Join(GlobalCertsDir.Get(), TLSCertFile) + if isFile(publicCertFile) { + return publicCertFile + } + return TLSCertFile } func getPrivateKeyFile() string { - return filepath.Join(GlobalCertsDir.Get(), PrivateKeyFile) + privateKeyFile := filepath.Join(GlobalCertsDir.Get(), PrivateKeyFile) + TLSPrivateKey := filepath.Join(GlobalCertsDir.Get(), TLSKeyFile) + if isFile(privateKeyFile) { + return privateKeyFile + } + return TLSPrivateKey } // EnvCertPassword is the environment variable which contains the password used diff --git a/pkg/certs/const.go b/pkg/certs/const.go index 8253e356102..9e116b93ad9 100644 --- a/pkg/certs/const.go +++ b/pkg/certs/const.go @@ -29,6 +29,12 @@ const ( // PublicCertFile Public certificate file for HTTPS. PublicCertFile = "public.crt" + // TLSCertFile Public certificate file for HTTPS. + TLSCertFile = "tls.crt" + // PrivateKeyFile Private key file for HTTPS. PrivateKeyFile = "private.key" + + // TLSKeyFile Private key file for HTTPS. + TLSKeyFile = "tls.key" )