Add support for configs
This commit is contained in:
@@ -5,20 +5,23 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/debridmediamanager.com/zurg/internal/config"
|
||||
"github.com/debridmediamanager.com/zurg/internal/torrent"
|
||||
)
|
||||
|
||||
// Router creates a WebDAV router
|
||||
func Router(mux *http.ServeMux) {
|
||||
t := torrent.NewTorrentManager(os.Getenv("RD_TOKEN"))
|
||||
c, err := config.LoadZurgConfig("./config.yml")
|
||||
if err != nil {
|
||||
log.Panicf("Config failed to load: %v", err)
|
||||
}
|
||||
|
||||
t := torrent.NewTorrentManager(os.Getenv("RD_TOKEN"), c)
|
||||
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
// requestPath := path.Clean(r.URL.Path)
|
||||
// log.Println(r.Method, requestPath)
|
||||
|
||||
switch r.Method {
|
||||
case "PROPFIND":
|
||||
HandlePropfindRequest(w, r, t)
|
||||
HandlePropfindRequest(w, r, t, c)
|
||||
|
||||
case http.MethodGet:
|
||||
HandleGetRequest(w, r, t)
|
||||
|
||||
Reference in New Issue
Block a user