mirror of
https://github.com/owenthereal/jqplay.git
synced 2025-04-19 06:02:17 +03:00
Fix sentry not working
This commit is contained in:
parent
d855bbc4f8
commit
c8887ab01d
15
Dockerfile
15
Dockerfile
@ -12,7 +12,9 @@ RUN apt-get update && \
|
||||
build-essential \
|
||||
autoconf \
|
||||
libtool \
|
||||
git
|
||||
git \
|
||||
; \
|
||||
apt-get clean
|
||||
|
||||
RUN git clone --recurse-submodules https://github.com/jqlang/jq.git && \
|
||||
cd jq && \
|
||||
@ -60,6 +62,17 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
|
||||
FROM ubuntu
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive \
|
||||
DEBCONF_NONINTERACTIVE_SEEN=true \
|
||||
LC_ALL=C.UTF-8 \
|
||||
LANG=C.UTF-8
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
ca-certificates \
|
||||
&& \
|
||||
apt-get clean
|
||||
|
||||
RUN useradd -m jqplay
|
||||
USER jqplay
|
||||
|
||||
|
@ -38,6 +38,7 @@ func Load() (*Config, error) {
|
||||
if dsn := conf.SentryDSN; dsn != "" {
|
||||
if err := sentry.Init(sentry.ClientOptions{
|
||||
Dsn: dsn,
|
||||
Debug: !conf.IsProd(),
|
||||
EnableTracing: true,
|
||||
TracesSampleRate: 0.2,
|
||||
AttachStacktrace: true,
|
||||
|
@ -3,9 +3,7 @@ package server
|
||||
import (
|
||||
"context"
|
||||
"html/template"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"os"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
@ -73,16 +71,20 @@ func newHTTPServer(cfg *config.Config, db *DB) (*http.Server, error) {
|
||||
|
||||
router := gin.New()
|
||||
router.Use(
|
||||
sentrygin.New(sentrygin.Options{
|
||||
Repanic: true,
|
||||
}),
|
||||
middleware.Timeout(requestTimeout),
|
||||
middleware.LimitContentLength(10),
|
||||
middleware.Secure(cfg.IsProd()),
|
||||
middleware.RequestID(),
|
||||
middleware.Logger(slog.New(slog.NewJSONHandler(os.Stderr, nil))),
|
||||
middleware.Logger(cfg.Logger),
|
||||
gin.Recovery(),
|
||||
)
|
||||
if cfg.SentryDSN != "" {
|
||||
router.Use(
|
||||
sentrygin.New(sentrygin.Options{
|
||||
Repanic: true,
|
||||
}),
|
||||
)
|
||||
}
|
||||
router.SetHTMLTemplate(tmpl)
|
||||
|
||||
h := &JQHandler{JQExec: jq.NewJQExec(), Config: cfg, DB: db}
|
||||
|
Loading…
x
Reference in New Issue
Block a user