Skip to content

Commit

Permalink
exit cleanly by default if no cleanup function has been provided
Browse files Browse the repository at this point in the history
  • Loading branch information
dreadl0ck committed Jan 20, 2021
1 parent b441d91 commit 8faf537
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions reloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ func NewCertReloader(certPath, keyPath string, logFile *os.File, cleanup func())

// run custom cleanup func if available
if cleanup != nil {

// 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)
}

// keep running.
// it is up to the caller of simplecert.NewCertReloader()
// to decide what to do now
}
}
}()
Expand Down

0 comments on commit 8faf537

Please sign in to comment.