feat: add debug flag

This commit is contained in:
2024-12-02 23:03:06 +00:00
parent 86bb51bd9f
commit 3de40bbfe7
4 changed files with 8 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
{ {
"port": 8080, "port": 8080,
"databasePath": "./data.sqlite", "databasePath": "./data.sqlite",
"hostName": "lycoris.lab" "hostName": "lycoris.lab",
"debug": true
} }

View File

@@ -12,6 +12,7 @@ type Config struct {
TemplateDirectoryPath string `json:"templateDirectoryPath"` TemplateDirectoryPath string `json:"templateDirectoryPath"`
HostKeyDirectoryPath string `json:"hostKeyDirectoryPath"` HostKeyDirectoryPath string `json:"hostKeyDirectoryPath"`
HostName string `json:"hostName"` HostName string `json:"hostName"`
Debug bool `json:"debug"`
} }
const defaultPort = 8080 const defaultPort = 8080

View File

@@ -68,7 +68,9 @@ func Initialize(config Config) (Services, error) {
return Services{}, err return Services{}, err
} }
bundb := bun.NewDB(db, sqlitedialect.New()) 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() sshProxy := sshproxy.New()

View File

@@ -27,7 +27,8 @@ sudo cat >/opt/tesseract/config.json <<EOF
{ {
"port": 80, "port": 80,
"databasePath": "./data.sqlite", "databasePath": "./data.sqlite",
"hostName": "HOSTNAME" "hostName": "HOSTNAME",
"debug": false
} }
EOF EOF