mirror of
https://github.com/foomo/simplecert.git
synced 2025-10-16 12:35:34 +00:00
exit cleanly by default if no cleanup function has been provided
This commit is contained in:
parent
b441d911f8
commit
8faf537327
12
reloader.go
12
reloader.go
@ -65,12 +65,14 @@ func NewCertReloader(certPath, keyPath string, logFile *os.File, cleanup func())
|
|||||||
|
|
||||||
// run custom cleanup func if available
|
// run custom cleanup func if available
|
||||||
if cleanup != nil {
|
if cleanup != nil {
|
||||||
cleanup()
|
|
||||||
}
|
|
||||||
|
|
||||||
// keep running.
|
// execute the cleanup function supplied by the user
|
||||||
// it is up to the caller of simplecert.NewCertReloader()
|
// if you want to keep the program running at this point, supply a cleanup function that does nothing.
|
||||||
// to decide what to do now
|
cleanup()
|
||||||
|
} else {
|
||||||
|
// if no cleanup function has been specified: exit cleanly
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user