From d1ba907e9e97fd0586eafa9075726f30f407cf32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AD=E3=82=89=E3=81=B2=E3=81=8B=E3=81=A0?= Date: Sun, 1 Mar 2026 10:09:38 +0900 Subject: [PATCH 1/2] feat: add GOKAPI_AWS_PROXY_DOWNLOAD environment variable --- docs/advanced.rst | 28 ++++++++++--------- .../configuration/cloudconfig/CloudConfig.go | 11 ++++---- internal/environment/Environment.go | 2 ++ 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/docs/advanced.rst b/docs/advanced.rst index 4b886a98..ab5dc6e0 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -145,19 +145,21 @@ Available environment variables All values that are described in :ref:`cloudstorage` can be passed as environment variables as well. No values are persistent; therefore, they need to be set on every start. -+---------------------------+-----------------------------------------+-----------------------------+ -| Name | Action | Example | -+===========================+=========================================+=============================+ -| GOKAPI_AWS_BUCKET | Sets the bucket name | gokapi | -+---------------------------+-----------------------------------------+-----------------------------+ -| GOKAPI_AWS_REGION | Sets the region name | eu-central-000 | -+---------------------------+-----------------------------------------+-----------------------------+ -| GOKAPI_AWS_KEY | Sets the API key | 123456789 | -+---------------------------+-----------------------------------------+-----------------------------+ -| GOKAPI_AWS_KEY_SECRET | Sets the API key secret | abcdefg123 | -+---------------------------+-----------------------------------------+-----------------------------+ -| GOKAPI_AWS_ENDPOINT | Sets the endpoint | eu-central-000.provider.com | -+---------------------------+-----------------------------------------+-----------------------------+ ++---------------------------+-----------------------------------------------------------------------------------+-----------------------------+ +| Name | Action | Example | ++===========================+===================================================================================+=============================+ +| GOKAPI_AWS_BUCKET | Sets the bucket name | gokapi | ++---------------------------+-----------------------------------------------------------------------------------+-----------------------------+ +| GOKAPI_AWS_REGION | Sets the region name | eu-central-000 | ++---------------------------+-----------------------------------------------------------------------------------+-----------------------------+ +| GOKAPI_AWS_KEY | Sets the API key | 123456789 | ++---------------------------+-----------------------------------------------------------------------------------+-----------------------------+ +| GOKAPI_AWS_KEY_SECRET | Sets the API key secret | abcdefg123 | ++---------------------------+-----------------------------------------------------------------------------------+-----------------------------+ +| GOKAPI_AWS_ENDPOINT | Sets the endpoint | eu-central-000.provider.com | ++---------------------------+-----------------------------------------------------------------------------------+-----------------------------+ +| GOKAPI_AWS_PROXY_DOWNLOAD | Proxies downloads through the server instead of redirecting to pre-signed S3 URLs | true | ++---------------------------+-----------------------------------------------------------------------------------+-----------------------------+ 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 From 1a62adf88fd7bef911891d1adc6c2ce64cb1567f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AD=E3=82=89=E3=81=B2=E3=81=8B=E3=81=A0?= Date: Sun, 1 Mar 2026 20:51:02 +0900 Subject: [PATCH 2/2] docs: restore GOKAPI_AWS_PROXY_DOWNLOAD table entry from eff0448 --- docs/advanced.rst | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/docs/advanced.rst b/docs/advanced.rst index ab5dc6e0..76d96281 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -145,21 +145,27 @@ Available environment variables All values that are described in :ref:`cloudstorage` can be passed as environment variables as well. No values are persistent; therefore, they need to be set on every start. -+---------------------------+-----------------------------------------------------------------------------------+-----------------------------+ -| Name | Action | Example | -+===========================+===================================================================================+=============================+ -| GOKAPI_AWS_BUCKET | Sets the bucket name | gokapi | -+---------------------------+-----------------------------------------------------------------------------------+-----------------------------+ -| GOKAPI_AWS_REGION | Sets the region name | eu-central-000 | -+---------------------------+-----------------------------------------------------------------------------------+-----------------------------+ -| GOKAPI_AWS_KEY | Sets the API key | 123456789 | -+---------------------------+-----------------------------------------------------------------------------------+-----------------------------+ -| GOKAPI_AWS_KEY_SECRET | Sets the API key secret | abcdefg123 | -+---------------------------+-----------------------------------------------------------------------------------+-----------------------------+ -| GOKAPI_AWS_ENDPOINT | Sets the endpoint | eu-central-000.provider.com | -+---------------------------+-----------------------------------------------------------------------------------+-----------------------------+ -| GOKAPI_AWS_PROXY_DOWNLOAD | Proxies downloads through the server instead of redirecting to pre-signed S3 URLs | true | -+---------------------------+-----------------------------------------------------------------------------------+-----------------------------+ ++---------------------------+-----------------------------------------+-----------------------------+ +| Name | Action | Example | ++===========================+=========================================+=============================+ +| GOKAPI_AWS_BUCKET | Sets the bucket name | gokapi | ++---------------------------+-----------------------------------------+-----------------------------+ +| GOKAPI_AWS_REGION | Sets the region name | eu-central-000 | ++---------------------------+-----------------------------------------+-----------------------------+ +| GOKAPI_AWS_KEY | Sets the API key | 123456789 | ++---------------------------+-----------------------------------------+-----------------------------+ +| GOKAPI_AWS_KEY_SECRET | Sets the API key secret | abcdefg123 | ++---------------------------+-----------------------------------------+-----------------------------+ +| 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 | | ++---------------------------+-----------------------------------------+-----------------------------+