Skip to content

Commit 082ee2f

Browse files
committed
feat(app): reload TLS certificate on SIGHUP
1 parent b783e7d commit 082ee2f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func cleanupOnEnd(appInst *app.App) {
2626
}()
2727
}
2828

29-
func reopenLogOnHup(appInst *app.App) {
29+
func reInitOnHup(appInst *app.App) {
3030
chSignal := make(chan os.Signal)
3131
signal.Notify(chSignal, syscall.SIGHUP)
3232

@@ -37,6 +37,11 @@ func reopenLogOnHup(appInst *app.App) {
3737
appInst.Shutdown()
3838
break
3939
}
40+
errs = appInst.ReLoadCertificates()
41+
if serverError.CheckError(errs...) {
42+
appInst.Shutdown()
43+
break
44+
}
4045
}
4146
}()
4247
}
@@ -88,7 +93,7 @@ func Main() (ok bool) {
8893
}
8994

9095
cleanupOnEnd(appInst)
91-
reopenLogOnHup(appInst)
96+
reInitOnHup(appInst)
9297
errs = appInst.Open()
9398
if serverError.CheckError(errs...) {
9499
return

0 commit comments

Comments
 (0)