mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
rcd: refactor rclone rc server to use lib/http
This commit is contained in:
12
fs/rc/rc.go
12
fs/rc/rc.go
@@ -13,12 +13,14 @@ import (
|
||||
_ "net/http/pprof" // install the pprof http handlers
|
||||
"time"
|
||||
|
||||
"github.com/rclone/rclone/cmd/serve/httplib"
|
||||
libhttp "github.com/rclone/rclone/lib/http"
|
||||
)
|
||||
|
||||
// Options contains options for the remote control server
|
||||
type Options struct {
|
||||
HTTPOptions httplib.Options
|
||||
HTTP libhttp.Config
|
||||
Auth libhttp.AuthConfig
|
||||
Template libhttp.TemplateConfig
|
||||
Enabled bool // set to enable the server
|
||||
Serve bool // set to serve files from remotes
|
||||
Files string // set to enable serving files locally
|
||||
@@ -36,14 +38,16 @@ type Options struct {
|
||||
|
||||
// DefaultOpt is the default values used for Options
|
||||
var DefaultOpt = Options{
|
||||
HTTPOptions: httplib.DefaultOpt,
|
||||
HTTP: libhttp.DefaultCfg(),
|
||||
Auth: libhttp.DefaultAuthCfg(),
|
||||
Template: libhttp.DefaultTemplateCfg(),
|
||||
Enabled: false,
|
||||
JobExpireDuration: 60 * time.Second,
|
||||
JobExpireInterval: 10 * time.Second,
|
||||
}
|
||||
|
||||
func init() {
|
||||
DefaultOpt.HTTPOptions.ListenAddr = "localhost:5572"
|
||||
DefaultOpt.HTTP.ListenAddr = []string{"localhost:5572"}
|
||||
}
|
||||
|
||||
// WriteJSON writes JSON in out to w
|
||||
|
||||
Reference in New Issue
Block a user