From 8031aabb7ed5eb9896ac33edf3439c5bcaa9a3bf Mon Sep 17 00:00:00 2001 From: Marius Date: Mon, 29 Mar 2021 15:12:17 +0200 Subject: [PATCH] cli: Add flag to disable SSL for S3 --- cmd/tusd/cli/composer.go | 5 +++++ cmd/tusd/cli/flags.go | 2 ++ 2 files changed, 7 insertions(+) diff --git a/cmd/tusd/cli/composer.go b/cmd/tusd/cli/composer.go index d4ecd4f..356cf8f 100644 --- a/cmd/tusd/cli/composer.go +++ b/cmd/tusd/cli/composer.go @@ -36,6 +36,11 @@ func CreateComposer() { s3Config = s3Config.WithS3DisableContentMD5Validation(true) } + if Flags.S3DisableSSL { + // Disable HTTPS and only use HTTP (helpful for debugging requests). + s3Config = s3Config.WithDisableSSL(true) + } + if Flags.S3Endpoint == "" { if Flags.S3TransferAcceleration { diff --git a/cmd/tusd/cli/flags.go b/cmd/tusd/cli/flags.go index a13bd5b..fdf9da9 100644 --- a/cmd/tusd/cli/flags.go +++ b/cmd/tusd/cli/flags.go @@ -26,6 +26,7 @@ var Flags struct { S3Endpoint string S3PartSize int64 S3DisableContentHashes bool + S3DisableSSL bool GCSBucket string GCSObjectPrefix string EnabledHooksString string @@ -66,6 +67,7 @@ func ParseFlags() { flag.StringVar(&Flags.S3Endpoint, "s3-endpoint", "", "Endpoint to use S3 compatible implementations like minio (requires s3-bucket to be pass)") flag.Int64Var(&Flags.S3PartSize, "s3-part-size", 50*1024*1024, "Size in bytes of the individual upload requests made to the S3 API. Defaults to 50MiB (experimental and may be removed in the future)") flag.BoolVar(&Flags.S3DisableContentHashes, "s3-disable-content-hashes", false, "Disable the calculation of MD5 and SHA256 hashes for the content that gets uploaded to S3 for minimized CPU usage (experimental and may be removed in the future)") + flag.BoolVar(&Flags.S3DisableSSL, "s3-disable-ssl", false, "Disable SSL and only use HTTP for communication with S3 (experimental and may be removed in the future)") flag.StringVar(&Flags.GCSBucket, "gcs-bucket", "", "Use Google Cloud Storage with this bucket as storage backend (requires the GCS_SERVICE_ACCOUNT_FILE environment variable to be set)") flag.StringVar(&Flags.GCSObjectPrefix, "gcs-object-prefix", "", "Prefix for GCS object names (can't contain underscore character)") flag.StringVar(&Flags.EnabledHooksString, "hooks-enabled-events", "pre-create,post-create,post-receive,post-terminate,post-finish", "Comma separated list of enabled hook events (e.g. post-create,post-finish). Leave empty to enable default events")