diff --git a/docs/advanced.rst b/docs/advanced.rst index 4b886a98..76d96281 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -158,6 +158,14 @@ All values that are described in :ref:`cloudstorage` can be passed as environmen +---------------------------+-----------------------------------------+-----------------------------+ | GOKAPI_AWS_ENDPOINT | Sets the endpoint | eu-central-000.provider.com | +---------------------------+-----------------------------------------+-----------------------------+ +| GOKAPI_AWS_PROXY_DOWNLOAD | If true, users will not be redirected | true | +| | | | +| | to a pre-signed S3 URL for downloading. | | +| | | | +| | Instead, Gokapi will download the file | | +| | | | +| | and proxy it to the user | | ++---------------------------+-----------------------------------------+-----------------------------+ diff --git a/internal/configuration/cloudconfig/CloudConfig.go b/internal/configuration/cloudconfig/CloudConfig.go index 05f412d2..cbf4d373 100644 --- a/internal/configuration/cloudconfig/CloudConfig.go +++ b/internal/configuration/cloudconfig/CloudConfig.go @@ -65,11 +65,12 @@ func Delete() error { func loadFromEnv(env *environment.Environment) CloudConfig { return CloudConfig{Aws: models.AwsConfig{ - Bucket: env.AwsBucket, - Region: env.AwsRegion, - Endpoint: env.AwsEndpoint, - KeyId: env.AwsKeyId, - KeySecret: env.AwsKeySecret, + Bucket: env.AwsBucket, + Region: env.AwsRegion, + Endpoint: env.AwsEndpoint, + KeyId: env.AwsKeyId, + KeySecret: env.AwsKeySecret, + ProxyDownload: env.AwsProxyDownload, }} } diff --git a/internal/environment/Environment.go b/internal/environment/Environment.go index c19197af..008b651f 100644 --- a/internal/environment/Environment.go +++ b/internal/environment/Environment.go @@ -89,6 +89,8 @@ type Environment struct { AwsKeySecret string `env:"AWS_KEY_SECRET"` // Sets the AWS endpoint AwsEndpoint string `env:"AWS_ENDPOINT"` + // Proxies downloads through the server instead of redirecting to pre-signed S3 URLs, if set to true + AwsProxyDownload bool `env:"AWS_PROXY_DOWNLOAD" envDefault:"false"` // List of active deprecations ActiveDeprecations []deprecation.Deprecation isSet bool