A platform for community discussion. Free, open, simple.
DEV: Remove SiteSetting.s3_force_path_style (#7210)
Rishabhad6ad3f67972
diff --git a/app/models/site_setting.rb b/app/models/site_setting.rbindex 873dfe28b86..e641fba8fe2 100644--- a/app/models/site_setting.rb+++ b/app/models/site_setting.rb@@ -139,10 +139,6 @@ class SiteSetting < ActiveRecord::BaseSiteSetting.enable_s3_uploads ? SiteSetting.s3_endpoint : GlobalSetting.s3_endpointend- def self.s3_force_path_style- SiteSetting.enable_s3_uploads ? SiteSetting.s3_force_path_style : GlobalSetting.s3_force_path_style- end-def self.enable_s3_uploadsSiteSetting.enable_s3_uploads || GlobalSetting.use_s3?end@@ -163,8 +159,6 @@ class SiteSetting < ActiveRecord::Baseelse"//#{bucket}.s3.dualstack.#{SiteSetting.Upload.s3_region}.amazonaws.com"end- elsif SiteSetting.s3_force_path_style- "//#{url_basename}/#{bucket}"else"//#{bucket}.#{url_basename}"enddiff --git a/config/discourse_defaults.conf b/config/discourse_defaults.confindex 1b5fba60734..421f72401c1 100644--- a/config/discourse_defaults.conf+++ b/config/discourse_defaults.conf@@ -174,7 +174,6 @@ s3_secret_access_key =s3_use_iam_profile = falses3_cdn_url =s3_endpoint =-s3_force_path_style =### rate limits apply to all sitesmax_user_api_reqs_per_minute = 20diff --git a/config/locales/server.en.yml b/config/locales/server.en.ymlindex b1724d15ed5..d0a9bf4ed28 100644--- a/config/locales/server.en.yml+++ b/config/locales/server.en.yml@@ -1507,7 +1507,6 @@ en:backup_frequency: "The number of days between backups."s3_backup_bucket: "The remote bucket to hold backups. WARNING: Make sure it is a private bucket."s3_endpoint: "The endpoint can be modified to backup to an S3 compatible service like DigitalOcean Spaces or Minio. WARNING: Leave blank if using AWS S3."- s3_force_path_style: "Enforce path-style addressing for your custom endpoint. IMPORTANT: Required for using Minio uploads and backups."s3_configure_tombstone_policy: "Enable automatic deletion policy for tombstone uploads. IMPORTANT: If disabled, no space will be reclaimed after uploads are deleted."s3_disable_cleanup: "Disable the removal of backups from S3 when removed locally."enable_s3_inventory: "Generate reports and verify uploads using Amazon S3 inventory. IMPORTANT: requires valid S3 credentials (both access key id & secret access key)."diff --git a/config/site_settings.yml b/config/site_settings.ymlindex 5b3c3e5c0cb..2a4c9051ae6 100644--- a/config/site_settings.yml+++ b/config/site_settings.yml@@ -1074,9 +1074,6 @@ files:s3_cdn_url:default: ""regex: '^https?:\/\/.+[^\/]$'- s3_force_path_style:- default: false- shadowed_by_global: trues3_configure_tombstone_policy:default: trueshadowed_by_global: truediff --git a/db/migrate/20190320104640_remove_s3_force_path_style.rb b/db/migrate/20190320104640_remove_s3_force_path_style.rbnew file mode 100644index 00000000000..81b33447e62--- /dev/null+++ b/db/migrate/20190320104640_remove_s3_force_path_style.rb@@ -0,0 +1,9 @@+class RemoveS3ForcePathStyle < ActiveRecord::Migration[5.2]+ def up+ execute "DELETE FROM site_settings WHERE name = 's3_force_path_style'"+ end++ def down+ raise ActiveRecord::IrreversibleMigration+ end+enddiff --git a/lib/s3_helper.rb b/lib/s3_helper.rbindex 34b0d8c247d..c2c6557092c 100644--- a/lib/s3_helper.rb+++ b/lib/s3_helper.rb@@ -192,8 +192,7 @@ class S3Helperdef self.s3_options(obj)opts = {- region: obj.s3_region,- force_path_style: SiteSetting.s3_force_path_style+ region: obj.s3_region}opts[:endpoint] = SiteSetting.s3_endpoint if SiteSetting.s3_endpoint.present?