From b21224d5ff420bc885c16cceeb8c98f798fe3654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Turbelin?= Date: Wed, 11 Feb 2026 13:35:22 +0100 Subject: [PATCH] Allow s3-compatible provider for db2fog configuration --- config/initializers/db2fog.rb | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/config/initializers/db2fog.rb b/config/initializers/db2fog.rb index a030841b82..7ef7e77724 100644 --- a/config/initializers/db2fog.rb +++ b/config/initializers/db2fog.rb @@ -2,16 +2,27 @@ require_relative 'spree' Rails.application.reloader.to_prepare do # See: https://github.com/openfoodfoundation/db2fog - DB2Fog.config = { + if ENV['S3_BACKUPS_HOST'].present? + DB2Fog.config = { + aws_access_key_id: ENV['S3_BACKUPS_ACCESS_KEY'], + aws_secret_access_key: ENV['S3_BACKUPS_SECRET'], + directory: ENV['S3_BACKUPS_BUCKET'], + provider: 'AWS', + scheme: ENV['S3_BACKUPS_SCHEME'], + host: ENV['S3_BACKUPS_HOST'] + } + else + DB2Fog.config = { :aws_access_key_id => Spree::Config[:s3_access_key], :aws_secret_access_key => Spree::Config[:s3_secret], :directory => ENV['S3_BACKUPS_BUCKET'], :provider => 'AWS' - } + } - region = ENV['S3_BACKUPS_REGION'] || ENV['S3_REGION'] + region = ENV['S3_BACKUPS_REGION'] || ENV['S3_REGION'] - # If no region is defined we leave this config key undefined (instead of nil), - # so that db2fog correctly applies it's default - DB2Fog.config[:region] = region if region + # If no region is defined we leave this config key undefined (instead of nil), + # so that db2fog correctly applies it's default + DB2Fog.config[:region] = region if region + end end