migrated out more modules and refactored db system

This commit is contained in:
2026-01-01 21:56:21 +11:00
parent 03095448d6
commit 1e09acdc57
80 changed files with 462 additions and 4992 deletions

View File

@@ -5,12 +5,10 @@ import (
"os"
"time"
"projectreshoot/pkg/logging"
"projectreshoot/pkg/tmdb"
"git.haelnorr.com/h/golib/hlog"
"git.haelnorr.com/h/golib/tmdb"
"github.com/joho/godotenv"
"github.com/pkg/errors"
"github.com/rs/zerolog"
)
type Config struct {
@@ -28,7 +26,7 @@ type Config struct {
AccessTokenExpiry int64 // Access token expiry in minutes
RefreshTokenExpiry int64 // Refresh token expiry in minutes
TokenFreshTime int64 // Time for tokens to stay fresh in minutes
LogLevel zerolog.Level // Log level for global logging. Defaults to info
LogLevel hlog.Level // Log level for global logging. Defaults to info
LogOutput string // "file", "console", or "both". Defaults to console
LogDir string // Path to create log files
TMDBToken string // Read access token for TMDB API
@@ -41,7 +39,7 @@ func GetConfig(args map[string]string) (*Config, error) {
var (
host string
port string
logLevel zerolog.Level
logLevel hlog.Level
logOutput string
valid bool
)
@@ -57,9 +55,9 @@ func GetConfig(args map[string]string) (*Config, error) {
port = GetEnvDefault("PORT", "3010")
}
if args["loglevel"] != "" {
logLevel = logging.GetLogLevel(args["loglevel"])
logLevel = hlog.LogLevel(args["loglevel"])
} else {
logLevel = logging.GetLogLevel(GetEnvDefault("LOG_LEVEL", "info"))
logLevel = hlog.LogLevel(GetEnvDefault("LOG_LEVEL", "info"))
}
if args["logoutput"] != "" {
opts := map[string]string{