From b18e4baed1bdbac1756fa0831a9cb71a1b816ea5 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 22 Jan 2020 17:35:31 -0800 Subject: [PATCH] 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. --- kirin.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kirin.go b/kirin.go index 17b467a..4b4e2ba 100644 --- a/kirin.go +++ b/kirin.go @@ -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(