Skip to content

Commit

Permalink
feat: add no_storage_cleaning env var
Browse files Browse the repository at this point in the history
  • Loading branch information
vrenaville committed Jan 5, 2024
1 parent ed961c1 commit c2a8608
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/kwkhtmltopdf_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func httpAbort(w http.ResponseWriter, err error, addr string) {

func handler(w http.ResponseWriter, r *http.Request) {
debug_enabled := os.Getenv("DEBUG")
no_storage_cleaning := os.Getenv("NO_STORAGE_CLEANING")
if debug_enabled != "" {
log.Info().Str("Method", r.Method).Str("Url",r.URL.Path).Msg("Parameters")
}
Expand Down Expand Up @@ -108,8 +109,11 @@ func handler(w http.ResponseWriter, r *http.Request) {
httpError(w, err, http.StatusNotFound, addr)
return
}
defer os.RemoveAll(tmpdir)

// Test if we want to remove storage, in case of debugging
//
if len(no_storage_cleaning) == 0 {
defer os.RemoveAll(tmpdir)
}
// parse request
reader, err := r.MultipartReader()
if err != nil {
Expand Down

0 comments on commit c2a8608

Please sign in to comment.