feat(server): wire subsonic.Mount under /rest
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
|||||||
|
|
||||||
"git.fabledsword.com/bvandeusen/minstrel/internal/auth"
|
"git.fabledsword.com/bvandeusen/minstrel/internal/auth"
|
||||||
"git.fabledsword.com/bvandeusen/minstrel/internal/library"
|
"git.fabledsword.com/bvandeusen/minstrel/internal/library"
|
||||||
|
"git.fabledsword.com/bvandeusen/minstrel/internal/subsonic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ScanTrigger is the subset of the scanner the HTTP handler needs. Kept as an
|
// ScanTrigger is the subset of the scanner the HTTP handler needs. Kept as an
|
||||||
@@ -21,13 +22,14 @@ type ScanTrigger interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
Logger *slog.Logger
|
Logger *slog.Logger
|
||||||
Pool *pgxpool.Pool
|
Pool *pgxpool.Pool
|
||||||
Scanner ScanTrigger
|
Scanner ScanTrigger
|
||||||
|
SubsonicCfg subsonic.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(logger *slog.Logger, pool *pgxpool.Pool, scanner ScanTrigger) *Server {
|
func New(logger *slog.Logger, pool *pgxpool.Pool, scanner ScanTrigger, subCfg subsonic.Config) *Server {
|
||||||
return &Server{Logger: logger, Pool: pool, Scanner: scanner}
|
return &Server{Logger: logger, Pool: pool, Scanner: scanner, SubsonicCfg: subCfg}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) Router() http.Handler {
|
func (s *Server) Router() http.Handler {
|
||||||
@@ -46,6 +48,7 @@ func (s *Server) Router() http.Handler {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
subsonic.Mount(r, s.Pool, s.Logger, s.SubsonicCfg)
|
||||||
}
|
}
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user