ISSUE-92 added http basic auth handler for upload
This commit is contained in:
19
cmd/cmd.go
19
cmd/cmd.go
@ -105,13 +105,11 @@ var globalFlags = []cli.Flag{
|
||||
Name: "gdrive-client-json-filepath",
|
||||
Usage: "",
|
||||
Value: "",
|
||||
EnvVar: "",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "gdrive-local-config-path",
|
||||
Usage: "",
|
||||
Value: "",
|
||||
EnvVar: "",
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "rate-limit",
|
||||
@ -151,6 +149,16 @@ var globalFlags = []cli.Flag{
|
||||
Name: "profiler",
|
||||
Usage: "enable profiling",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "http-auth-user",
|
||||
Usage: "user for http basic auth",
|
||||
Value: "",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "http-auth-pass",
|
||||
Usage: "pass for http basic auth",
|
||||
Value: "",
|
||||
},
|
||||
}
|
||||
|
||||
type Cmd struct {
|
||||
@ -232,6 +240,13 @@ func New() *Cmd {
|
||||
options = append(options, server.ForceHTTPs())
|
||||
}
|
||||
|
||||
if httpAuthUser := c.String("http-auth-user"); httpAuthUser == "" {
|
||||
} else if httpAuthPass := c.String("http-auth-pass"); httpAuthPass == "" {
|
||||
} else {
|
||||
options = append(options, server.HttpAuthCredentials(httpAuthUser, httpAuthPass))
|
||||
}
|
||||
|
||||
|
||||
switch provider := c.String("provider"); provider {
|
||||
case "s3":
|
||||
if accessKey := c.String("aws-access-key"); accessKey == "" {
|
||||
|
Reference in New Issue
Block a user