From 3de40bbfe7e1cbeef35c2bad7537de4ac358ac4f Mon Sep 17 00:00:00 2001 From: Kenneth Date: Mon, 2 Dec 2024 23:03:06 +0000 Subject: [PATCH] feat: add debug flag --- config.json | 3 ++- internal/service/config.go | 1 + internal/service/service.go | 4 +++- scripts/install.sh | 3 ++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config.json b/config.json index 1d8b716..bba1373 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,6 @@ { "port": 8080, "databasePath": "./data.sqlite", - "hostName": "lycoris.lab" + "hostName": "lycoris.lab", + "debug": true } \ No newline at end of file diff --git a/internal/service/config.go b/internal/service/config.go index 56155d8..257f510 100644 --- a/internal/service/config.go +++ b/internal/service/config.go @@ -12,6 +12,7 @@ type Config struct { TemplateDirectoryPath string `json:"templateDirectoryPath"` HostKeyDirectoryPath string `json:"hostKeyDirectoryPath"` HostName string `json:"hostName"` + Debug bool `json:"debug"` } const defaultPort = 8080 diff --git a/internal/service/service.go b/internal/service/service.go index 286ece6..cd4d8ec 100644 --- a/internal/service/service.go +++ b/internal/service/service.go @@ -68,7 +68,9 @@ func Initialize(config Config) (Services, error) { return Services{}, err } bundb := bun.NewDB(db, sqlitedialect.New()) - bundb.AddQueryHook(bundebug.NewQueryHook(bundebug.WithVerbose(true))) + if config.Debug { + bundb.AddQueryHook(bundebug.NewQueryHook(bundebug.WithVerbose(true))) + } sshProxy := sshproxy.New() diff --git a/scripts/install.sh b/scripts/install.sh index a15635b..d00d44e 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -27,7 +27,8 @@ sudo cat >/opt/tesseract/config.json <