mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2024-11-22 20:20:19 +01:00
Refactor and update Readme
This commit is contained in:
parent
9f7a123047
commit
f644a930dc
3 changed files with 6 additions and 6 deletions
|
@ -126,6 +126,7 @@ provider | which storage provider to use | (s3, grdrive or local) |
|
|||
aws-access-key | aws access key | | AWS_ACCESS_KEY
|
||||
aws-secret-key | aws access key | | AWS_SECRET_KEY
|
||||
bucket | aws bucket | | BUCKET
|
||||
s3-no-multipart | disables s3 multipart upload | false | |
|
||||
basedir | path storage for local/gdrive provider| |
|
||||
gdrive-client-json-filepath | path to oauth client json config for gdrive provider| |
|
||||
gdrive-local-config-path | path to store local transfer.sh config cache for gdrive provider| |
|
||||
|
|
|
@ -116,8 +116,8 @@ var globalFlags = []cli.Flag{
|
|||
EnvVar: "BUCKET",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "no-multipart",
|
||||
Usage: "Disables Multipart Puts",
|
||||
Name: "s3-no-multipart",
|
||||
Usage: "Disables S3 Multipart Puts",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "gdrive-client-json-filepath",
|
||||
|
@ -296,7 +296,7 @@ func New() *Cmd {
|
|||
panic("secret-key not set.")
|
||||
} else if bucket := c.String("bucket"); bucket == "" {
|
||||
panic("bucket not set.")
|
||||
} else if storage, err := server.NewS3Storage(accessKey, secretKey, bucket, c.String("s3-endpoint"), logger, c.Bool("no-multipart")); err != nil {
|
||||
} else if storage, err := server.NewS3Storage(accessKey, secretKey, bucket, c.String("s3-endpoint"), logger, c.Bool("s3-no-multipart")); err != nil {
|
||||
panic(err)
|
||||
} else {
|
||||
options = append(options, server.UseStorage(storage))
|
||||
|
|
|
@ -201,8 +201,7 @@ func (s *S3Storage) Delete(token string, filename string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func (s *S3Storage) PutMulti(token string, filename string, reader io.Reader, contentType string, contentLength uint64) (err error) {
|
||||
key := fmt.Sprintf("%s/%s", token, filename)
|
||||
func (s *S3Storage) putMulti(key string, reader io.Reader, contentType string, contentLength uint64) (err error) {
|
||||
|
||||
var (
|
||||
multi *s3.Multi
|
||||
|
@ -320,7 +319,7 @@ func (s *S3Storage) Put(token string, filename string, reader io.Reader, content
|
|||
|
||||
s.logger.Printf("Uploading file %s to S3 Bucket", filename)
|
||||
if s.noMultipart {
|
||||
err = s.PutMulti(token, filename, reader, contentType, contentLength)
|
||||
err = s.putMulti(key, reader, contentType, contentLength)
|
||||
} else {
|
||||
err = s.bucket.PutReader(key, reader, int64(contentLength), contentType, s3.Private, s3.Options{})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue