Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: do not clean storage if set, for debugging #22

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/[email protected]

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
Loading