kirin: fix bug when using pure autocert

When using the `autocert` route, we actually don't need to pass anything
into `ListenAndServeTLS`, instead we can pass blank strings.
This commit is contained in:
Olaoluwa Osuntokun
2020-01-22 17:35:31 -08:00
parent 4b60be65ee
commit b18e4baed1

View File

@@ -83,8 +83,7 @@ func start() error {
}
// Create TLS certificates.
tlsKeyFile := filepath.Join(kirinDataDir, defaultTLSKeyFilename)
tlsCertFile := filepath.Join(kirinDataDir, defaultTLSCertFilename)
var tlsKeyFile, tlsCertFile string
switch {
// When using autocert, we set a TLSConfig on the server so the key and
// cert file we pass in are ignored and don't need to exist.
@@ -121,6 +120,8 @@ func start() error {
// and save them at the specified location (if they don't already
// exist).
default:
tlsKeyFile = filepath.Join(kirinDataDir, defaultTLSKeyFilename)
tlsCertFile = filepath.Join(kirinDataDir, defaultTLSCertFilename)
if !fileExists(tlsCertFile) && !fileExists(tlsKeyFile) {
log.Infof("Generating TLS certificates...")
err := cert.GenCertPair(