fix now-playing status on listenbrainz endpoint and add config support

This commit is contained in:
2026-02-28 16:08:46 -08:00
parent a2ffbbdce4
commit 7542eaf321
10 changed files with 103 additions and 22 deletions

View File

@@ -5,6 +5,8 @@ import (
"fmt"
"os"
"muzi/config"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgxpool"
)
@@ -25,17 +27,7 @@ func CreateAllTables() error {
}
func GetDbUrl(dbName bool) string {
host := os.Getenv("PGHOST")
port := os.Getenv("PGPORT")
user := os.Getenv("PGUSER")
pass := os.Getenv("PGPASSWORD")
if dbName {
return fmt.Sprintf("postgres://%s:%s@%s:%s/%s",
user, pass, host, port, "muzi")
} else {
return fmt.Sprintf("postgres://%s:%s@%s:%s", user, pass, host, port)
}
return config.Get().Database.GetDbUrl(dbName)
}
func CreateDB() error {