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
|
||||
if cleanup != nil {
|
||||
cleanup()
|
||||
}
|
||||
|
||||
// keep running.
|
||||
// it is up to the caller of simplecert.NewCertReloader()
|
||||
// to decide what to do now
|
||||
// execute the cleanup function supplied by the user
|
||||
// if you want to keep the program running at this point, supply a cleanup function that does nothing.
|
||||
cleanup()
|
||||
} else {
|
||||
// if no cleanup function has been specified: exit cleanly
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user