'wdcli backup': Rework backup process

This commit reworks the backup process to dynamically find the list of
components.
This commit is contained in:
Tom Wiesing 2022-09-17 16:30:32 +02:00
parent 55bee7422d
commit 5cd5ae9be2
No known key found for this signature in database
32 changed files with 361 additions and 279 deletions

View file

@ -0,0 +1,39 @@
package control
import (
"net/http"
"github.com/tkw1536/goprogram/stream"
)
// Server returns an http.Mux that implements the main server instance
func (control Control) Server(io stream.IOStream) (http.Handler, error) {
// self server
self, err := control.self(io)
if err != nil {
return nil, err
}
resolver, err := control.resolver(io)
if err != nil {
return nil, err
}
info, err := control.info(io)
if err != nil {
return nil, err
}
// resolver
mux := http.NewServeMux()
mux.Handle("/", self)
mux.Handle("/go/", resolver)
mux.Handle("/wisski/get/", resolver)
// TODO: Fix me!
mux.Handle("/dis/", info)
return mux, nil
}