Skip to content

Commit

Permalink
Merge pull request #22 from camptocamp/devel
Browse files Browse the repository at this point in the history
feat: do not clean storage if set, for debugging
  • Loading branch information
vrenaville authored Jan 8, 2024
2 parents 2123e83 + c2a8608 commit e1f3308
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# first stage: build kwkhtmltopdf_server

FROM golang:1.18.3
FROM golang:1.21.5
RUN mkdir /tmp/kwkhtml
WORKDIR /tmp/kwkhtml
COPY server/kwkhtmltopdf_server.go .
RUN go mod init kwkhtml
RUN go get -u github.com/rs/zerolog/log@v1.27.0
RUN go get -u github.com/rs/zerolog/log@v1.31.0
RUN go get -u github.com/pkg/errors@v0.9.1

RUN go build kwkhtmltopdf_server.go
Expand All @@ -18,7 +18,7 @@ RUN set -x \
&& apt update \
&& apt -y install --no-install-recommends wget ca-certificates fonts-liberation2 fonts-nanum-coding fonts-horai-umefont fonts-wqy-microhei \
&& wget -q -O /tmp/wkhtmltox.deb https://github.com/odoo/wkhtmltopdf/releases/download/nightly/wkhtmltox_0.13.0-1.nightly.bookworm_amd64.deb \
&& echo "a8f28ec5a71d18a4791e48ece56ad7395fd0f935 /tmp/wkhtmltox.deb" | sha1sum -c - \
&& echo "8b3e6ec574f31e4f19644f2c9e00bb929a1cb207 /tmp/wkhtmltox.deb" | sha1sum -c - \
&& apt -y install /tmp/wkhtmltox.deb \
&& apt -y purge wget --autoremove \
&& apt -y clean \
Expand Down
6 changes: 6 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@

# 2.0.1 (2024-01-05)

Use new build from odoo for wkhtmltopdf bin, use new bookworm debian
Bump zerolog extra go package

# 0.9.3 (2020-04-15)

Remove gsfonts and xfonts-100dpi. Use fonts-liberation2 instead
Expand Down
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 e1f3308

Please sign in to comment.