1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-09 12:03:20 +00:00

auth proxy: convert options to new style

This commit is contained in:
Nick Craig-Wood
2025-03-28 13:58:36 +00:00
parent 028316ba5d
commit 6054c4e49d
13 changed files with 43 additions and 40 deletions

View File

@@ -83,7 +83,7 @@ control the stats printing.
},
Run: func(command *cobra.Command, args []string) {
var f fs.Fs
if proxyflags.Opt.AuthProxy == "" {
if proxy.Opt.AuthProxy == "" {
cmd.CheckArgs(1, 1, command, args)
f = cmd.NewFsSrc(args)
} else {
@@ -145,8 +145,8 @@ func run(ctx context.Context, f fs.Fs, opt Options) (s *HTTP, err error) {
opt: opt,
}
if proxyflags.Opt.AuthProxy != "" {
s.proxy = proxy.New(ctx, &proxyflags.Opt, &vfscommon.Opt)
if proxy.Opt.AuthProxy != "" {
s.proxy = proxy.New(ctx, &proxy.Opt, &vfscommon.Opt)
// override auth
s.opt.Auth.CustomAuthFn = s.auth
} else {

View File

@@ -12,7 +12,7 @@ import (
"time"
_ "github.com/rclone/rclone/backend/local"
"github.com/rclone/rclone/cmd/serve/proxy/proxyflags"
"github.com/rclone/rclone/cmd/serve/proxy"
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/fs/filter"
libhttp "github.com/rclone/rclone/lib/http"
@@ -39,7 +39,7 @@ func start(ctx context.Context, t *testing.T, f fs.Fs) (s *HTTP, testURL string)
},
}
opts.HTTP.ListenAddr = []string{testBindAddress}
if proxyflags.Opt.AuthProxy == "" {
if proxy.Opt.AuthProxy == "" {
opts.Auth.BasicUser = testUser
opts.Auth.BasicPass = testPass
}
@@ -110,9 +110,9 @@ func testGET(t *testing.T, useProxy bool) {
cmd := "go run " + prog + " " + files
// FIXME this is untidy setting a global variable!
proxyflags.Opt.AuthProxy = cmd
proxy.Opt.AuthProxy = cmd
defer func() {
proxyflags.Opt.AuthProxy = ""
proxy.Opt.AuthProxy = ""
}()
f = nil