Create bogus certificate if none passed
This commit is contained in:
parent
249f03fdd0
commit
845cf15314
|
@ -1,6 +1,6 @@
|
|||
DATA_MOUNT_PATH=/mnt/storage
|
||||
CERTIFICATE_PATH=/example/server.crt
|
||||
KEYPAIR_PATH=/example/server.key
|
||||
CERTIFICATE_PATH=
|
||||
KEYPAIR_PATH=
|
||||
|
||||
LISTEN_PORT=7777
|
||||
TRUSTED_KEYS=
|
||||
|
|
|
@ -605,9 +605,16 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
serverCertificate, err := tls.LoadX509KeyPair(*certificatePath, *keypairPath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
var serverCertificate tls.Certificate
|
||||
|
||||
if *certificatePath != "" && *keypairPath != "" {
|
||||
serverCertificate, err = tls.LoadX509KeyPair(*certificatePath, *keypairPath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
} else {
|
||||
serverCertificate = bogusCertificate
|
||||
}
|
||||
|
||||
server := &http.Server{
|
||||
|
|
Loading…
Reference in a new issue