ISSUE-92 added http basic auth handler for upload

This commit is contained in:
Andrea Spacca
2018-06-23 18:46:28 +02:00
parent 8a0e3d39f2
commit baa2fdc86c
4 changed files with 58 additions and 6 deletions

View File

@ -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 == "" {