mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 09:00:10 +00:00
Crash on SSL cert/key error, describe issue in log
if serving ssl/tls fails, the cert/key files are checked to see if they are accessible, and any errors logged.
This commit is contained in:
parent
2be7baea4a
commit
b75bd4d6c5
11
main.go
11
main.go
@ -557,7 +557,16 @@ func start(asDaemon, firstCall bool) {
|
|||||||
cert := app.config.Section("advanced").Key("tls_cert").MustString("")
|
cert := app.config.Section("advanced").Key("tls_cert").MustString("")
|
||||||
key := app.config.Section("advanced").Key("tls_key").MustString("")
|
key := app.config.Section("advanced").Key("tls_key").MustString("")
|
||||||
if err := SRV.ListenAndServeTLS(cert, key); err != nil {
|
if err := SRV.ListenAndServeTLS(cert, key); err != nil {
|
||||||
app.err.Printf("Failure serving: %s", err)
|
filesToCheck := []string{cert, key}
|
||||||
|
fileNames := []string{"Certificate", "Key"}
|
||||||
|
for i, v := range filesToCheck {
|
||||||
|
_, err := os.Stat(v)
|
||||||
|
if err != nil {
|
||||||
|
app.err.Printf("SSL/TLS %s: %v\n", fileNames[i], err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
app.err.Fatalf("Failure serving with SSL/TLS: %s", err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := SRV.ListenAndServe(); err != nil {
|
if err := SRV.ListenAndServe(); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user