mirror of
https://github.com/Luzifer/share.git
synced 2024-12-20 10:31:16 +00:00
Add support for setting S3 compatible endpoint
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
f2e3eebbac
commit
3b8e103edd
2 changed files with 7 additions and 1 deletions
1
main.go
1
main.go
|
@ -22,6 +22,7 @@ var (
|
|||
Bootstrap bool `flag:"bootstrap" default:"false" description:"Upload frontend files into bucket"`
|
||||
Bucket string `flag:"bucket" default:"" description:"S3 bucket to upload files to" validate:"nonzero"`
|
||||
ContentType string `flag:"content-type,c" default:"" description:"Force content-type to be set to this value"`
|
||||
Endpoint string `flag:"endpoint" default:"" description:"Override AWS S3 endpoint (i.e. to use MinIO)"`
|
||||
FileTemplate string `flag:"file-template" vardefault:"file_template" description:"Full name template of the uploaded file"`
|
||||
Listen string `flag:"listen" default:"" description:"Enable HTTP server if set to IP/Port (e.g. ':3000')"`
|
||||
LogLevel string `flag:"log-level" default:"info" description:"Log level (debug, info, warn, error, fatal)"`
|
||||
|
|
|
@ -64,7 +64,12 @@ func executeUpload(inFileName string, inFileHandle io.ReadSeeker, useCalculatedF
|
|||
contentEncoding = aws.String("gzip")
|
||||
}
|
||||
|
||||
sess := session.Must(session.NewSession())
|
||||
var awsCfgs []*aws.Config
|
||||
if cfg.Endpoint != "" {
|
||||
awsCfgs = append(awsCfgs, &aws.Config{Endpoint: &cfg.Endpoint, S3ForcePathStyle: aws.Bool(true)})
|
||||
}
|
||||
|
||||
sess := session.Must(session.NewSession(awsCfgs...))
|
||||
svc := s3.New(sess)
|
||||
|
||||
ps, err := newProgressSeeker(inFileHandle)
|
||||
|
|
Loading…
Reference in a new issue