Add -s3-endpoint to command line arguments
to support S3 compatilbe implementations like minio
This commit is contained in:
parent
af5e0e834d
commit
3cb4e0907d
|
@ -32,12 +32,20 @@ func CreateComposer() {
|
|||
store := filestore.New(dir)
|
||||
store.UseIn(Composer)
|
||||
} else {
|
||||
s3Config := aws.NewConfig()
|
||||
|
||||
if Flags.S3Endpoint == "" {
|
||||
stdout.Printf("Using 's3://%s' as S3 bucket for storage.\n", Flags.S3Bucket)
|
||||
} else {
|
||||
stdout.Printf("Using '%s/%s' as S3 endpoint and bucket for storage.\n", Flags.S3Endpoint, Flags.S3Bucket)
|
||||
|
||||
s3Config = s3Config.WithEndpoint(Flags.S3Endpoint).WithS3ForcePathStyle(true)
|
||||
}
|
||||
|
||||
// Derive credentials from AWS_SECRET_ACCESS_KEY, AWS_ACCESS_KEY_ID and
|
||||
// AWS_REGION environment variables.
|
||||
credentials := aws.NewConfig().WithCredentials(credentials.NewEnvCredentials())
|
||||
store := s3store.New(Flags.S3Bucket, s3.New(session.New(), credentials))
|
||||
s3Config = s3Config.WithCredentials(credentials.NewEnvCredentials())
|
||||
store := s3store.New(Flags.S3Bucket, s3.New(session.New(), s3Config))
|
||||
store.UseIn(Composer)
|
||||
|
||||
locker := memorylocker.New()
|
||||
|
|
|
@ -14,6 +14,7 @@ var Flags struct {
|
|||
Basepath string
|
||||
Timeout int64
|
||||
S3Bucket string
|
||||
S3Endpoint string
|
||||
HooksDir string
|
||||
ShowVersion bool
|
||||
ExposeMetrics bool
|
||||
|
@ -32,6 +33,7 @@ func ParseFlags() {
|
|||
flag.StringVar(&Flags.Basepath, "base-path", "/files/", "Basepath of the HTTP server")
|
||||
flag.Int64Var(&Flags.Timeout, "timeout", 30*1000, "Read timeout for connections in milliseconds. A zero value means that reads will not timeout")
|
||||
flag.StringVar(&Flags.S3Bucket, "s3-bucket", "", "Use AWS S3 with this bucket as storage backend (requires the AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_REGION environment variables to be set)")
|
||||
flag.StringVar(&Flags.S3Endpoint, "s3-endpoint", "", "Endpoint to use S3 compatible implementations like minio (requires s3-bucket to be pass)")
|
||||
flag.StringVar(&Flags.HooksDir, "hooks-dir", "", "Directory to search for available hooks scripts")
|
||||
flag.BoolVar(&Flags.ShowVersion, "version", false, "Print tusd version information")
|
||||
flag.BoolVar(&Flags.ExposeMetrics, "expose-metrics", true, "Expose metrics about tusd usage")
|
||||
|
|
Loading…
Reference in New Issue