aperture: remove unused certificate/key parameters

This commit is contained in:
Oliver Gugger
2020-04-28 14:02:58 +02:00
parent e885935d8c
commit ee865f0d39

View File

@@ -100,7 +100,6 @@ func start() error {
} }
// Create TLS certificates. // Create TLS certificates.
var tlsKeyFile, tlsCertFile string
switch { switch {
// When using autocert, we set a TLSConfig on the server so the key and // 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. // cert file we pass in are ignored and don't need to exist.
@@ -139,8 +138,8 @@ func start() error {
// and save them at the specified location (if they don't already // and save them at the specified location (if they don't already
// exist). // exist).
default: default:
tlsKeyFile = filepath.Join(apertureDataDir, defaultTLSKeyFilename) tlsKeyFile := filepath.Join(apertureDataDir, defaultTLSKeyFilename)
tlsCertFile = filepath.Join(apertureDataDir, defaultTLSCertFilename) tlsCertFile := filepath.Join(apertureDataDir, defaultTLSCertFilename)
if !fileExists(tlsCertFile) && !fileExists(tlsKeyFile) { if !fileExists(tlsCertFile) && !fileExists(tlsKeyFile) {
log.Infof("Generating TLS certificates...") log.Infof("Generating TLS certificates...")
err := cert.GenCertPair( err := cert.GenCertPair(
@@ -176,7 +175,9 @@ func start() error {
errChan := make(chan error) errChan := make(chan error)
go func() { go func() {
errChan <- httpsServer.ListenAndServeTLS(tlsCertFile, tlsKeyFile) // The httpsServer.TLSConfig contains certificates at this point
// so we don't need to pass in certificate and key file names.
errChan <- httpsServer.ListenAndServeTLS("", "")
}() }()
// If we need to listen over Tor as well, we'll set up the onion // If we need to listen over Tor as well, we'll set up the onion