diff --git a/config/initializers/db2fog.rb b/config/initializers/db2fog.rb index 7c7a2d6d396..1e05ceae1af 100644 --- a/config/initializers/db2fog.rb +++ b/config/initializers/db2fog.rb @@ -2,6 +2,6 @@ DB2Fog.config = { :aws_access_key_id => Spree::Config[:s3_access_key], :aws_secret_access_key => Spree::Config[:s3_secret], - :directory => Spree::Config[:s3_bucket], + :directory => ENV['S3_BACKUPS_BUCKET'], :provider => 'AWS' } diff --git a/config/initializers/spree.rb b/config/initializers/spree.rb index e63d21bde9b..e05f847f004 100644 --- a/config/initializers/spree.rb +++ b/config/initializers/spree.rb @@ -20,6 +20,13 @@ # Auto-capture payments. Without this option, payments must be manually captured in the paypal interface. config.auto_capture = true #config.override_actionmailer_config = false + + # S3 settings + config.s3_bucket = ENV['S3_BUCKET'] if ENV['S3_BUCKET'] + config.s3_access_key = ENV['S3_ACCESS_KEY'] if ENV['S3_ACCESS_KEY'] + config.s3_secret = ENV['S3_SECRET'] if ENV['S3_SECRET'] + config.use_s3 = true if ENV['S3_ACCESS_KEY'] && ENV['S3_SECRET'] + config.s3_protocol = ENV.fetch('S3_PROTOCOL', 'https') end # Don't log users out when setting a new password diff --git a/config/schedule.rb b/config/schedule.rb index 4bb20df5453..4cb7a5c1caf 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -21,11 +21,11 @@ end every 1.day, at: '2:45am' do - rake 'db2fog:clean' + rake 'db2fog:clean' if ENV['S3_BACKUPS_BUCKET'] end every 4.hours do - rake 'db2fog:backup' + rake 'db2fog:backup' if ENV['S3_BACKUPS_BUCKET'] end every 5.minutes do