mirror of
https://github.com/writefreely/writefreely
synced 2024-11-14 05:07:07 +00:00
Delete socket file on server shutdown
This commit is contained in:
parent
f84b4b0f74
commit
a0f1e1821f
1 changed files with 10 additions and 0 deletions
10
app.go
10
app.go
|
@ -845,6 +845,16 @@ func connectToDatabase(app *App) {
|
||||||
func shutdown(app *App) {
|
func shutdown(app *App) {
|
||||||
log.Info("Closing database connection...")
|
log.Info("Closing database connection...")
|
||||||
app.db.Close()
|
app.db.Close()
|
||||||
|
if strings.HasPrefix(app.cfg.Server.Bind, "/") {
|
||||||
|
// Clean up socket
|
||||||
|
log.Info("Removing socket file...")
|
||||||
|
err := os.Remove(app.cfg.Server.Bind)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Unable to remove socket: %s", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
log.Info("Success.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateUser creates a new admin or normal user from the given credentials.
|
// CreateUser creates a new admin or normal user from the given credentials.
|
||||||
|
|
Loading…
Reference in a new issue