aboutsummaryrefslogtreecommitdiff
path: root/database/functions.go
diff options
context:
space:
mode:
Diffstat (limited to 'database/functions.go')
-rw-r--r--database/functions.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/database/functions.go b/database/functions.go
new file mode 100644
index 0000000..71723ca
--- /dev/null
+++ b/database/functions.go
@@ -0,0 +1,22 @@
+package database
+
+import (
+ "path/filepath"
+
+ "dove/config"
+
+ "gorm.io/gorm/logger"
+)
+
+func resolveDatabasePath() string {
+ return filepath.Join(config.DataDir, DATABASE_FILE_NAME)
+}
+
+func resolveGORMLogLevel() logger.Interface {
+ switch config.Server.Debug {
+ case true:
+ return logger.Default.LogMode(logger.Info)
+ default:
+ return logger.Default.LogMode(logger.Silent)
+ }
+}