From 0b393a0d6d2a9138bea6f7d86e8f412a794b6788 Mon Sep 17 00:00:00 2001 From: OrangeDrangon <25403517+OrangeDrangon@users.noreply.github.com> Date: Sun, 26 Oct 2025 11:58:26 -0400 Subject: [PATCH] add custom s3 support storage config option (#239) Options are documented here including an example on how to set a custom endpoint: https://guides.rubyonrails.org/active_storage_overview.html#s3-service-amazon-s3-and-s3-compatible-apis --- .env.example | 9 +++++++++ config/storage.yml | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index b6014d453..23b85ed72 100644 --- a/.env.example +++ b/.env.example @@ -107,3 +107,12 @@ BRAND_NAME= # CLOUDFLARE_SECRET_ACCESS_KEY= # CLOUDFLARE_BUCKET= # +# Generic S3 +# ========== +# ACTIVE_STORAGE_SERVICE=generic_s3 <- Enables Generic S3 storage +# GENERIC_S3_ACCESS_KEY_ID= +# GENERIC_S3_SECRET_ACCESS_KEY= +# GENERIC_S3_REGION= +# GENERIC_S3_BUCKET= +# GENERIC_S3_ENDPOINT= +# GENERIC_S3_FORCE_PATH_STYLE= <- defaults to false diff --git a/config/storage.yml b/config/storage.yml index c6acb48e4..aa9050108 100644 --- a/config/storage.yml +++ b/config/storage.yml @@ -22,4 +22,12 @@ cloudflare: bucket: <%= ENV['CLOUDFLARE_BUCKET'] %> request_checksum_calculation: "when_required" response_checksum_validation: "when_required" - + +generic_s3: + service: S3 + access_key_id: <%= ENV["GENERIC_S3_ACCESS_KEY_ID"] %> + secret_access_key: <%= ENV["GENERIC_S3_SECRET_ACCESS_KEY"] %> + region: <%= ENV["GENERIC_S3_REGION"] %> + bucket: <%= ENV["GENERIC_S3_BUCKET"] %> + endpoint: <%= ENV["GENERIC_S3_ENDPOINT"] %> + force_path_style: <%= ActiveModel::Type::Boolean.new.cast(ENV.fetch("GENERIC_S3_FORCE_PATH_STYLE", "false")) %>