diff --git a/app/models/setting.rb b/app/models/setting.rb index 27acdcc..daa4b29 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -15,6 +15,9 @@ class Setting < RailsSettings::Base field :redis_url, type: :string, default: ENV["REDIS_URL"] || "redis://localhost:6379/0" + field :s3_enabled, type: :boolean, + default: ENV["S3_ENABLED"] && ENV["S3_ENABLED"].to_s != "false" + # # Registrations # diff --git a/config/environments/development.rb b/config/environments/development.rb index e13b809..9f73578 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -71,7 +71,7 @@ Rails.application.configure do # Allow requests from any IP config.web_console.permissions = '0.0.0.0/0' - if ENV["S3_ENABLED"] + if ENV["S3_ENABLED"] && ENV["S3_ENABLED"].to_s != "false" config.active_storage.service = :s3 else config.active_storage.service = :local diff --git a/config/environments/production.rb b/config/environments/production.rb index 5adf41e..16e7fa5 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -110,7 +110,7 @@ Rails.application.configure do # Set this to true and configure the email server for immediate delivery to raise delivery errors. config.action_mailer.raise_delivery_errors = true - if ENV["S3_ENABLED"] + if ENV["S3_ENABLED"] && ENV["S3_ENABLED"].to_s != "false" config.active_storage.service = :s3 else config.active_storage.service = :local diff --git a/config/storage.yml b/config/storage.yml index 3ddfbb8..9a15623 100644 --- a/config/storage.yml +++ b/config/storage.yml @@ -6,7 +6,7 @@ test: service: Disk root: <%= Rails.root.join("tmp/storage") %> -<% if ENV["S3_ENABLED"] %> +<% if ENV["S3_ENABLED"] && ENV["S3_ENABLED"].to_s != "false" %> s3: service: S3 endpoint: <%= ENV["S3_ENDPOINT"] %> diff --git a/docker-compose.yml b/docker-compose.yml index 5106dfd..6e0ff50 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -44,6 +44,7 @@ services: REDIS_URL: redis://redis:6379/0 RS_REDIS_URL: redis://redis:6379/1 RS_STORAGE_URL: "http://localhost:4567" + S3_ENABLED: false depends_on: - ldap - redis @@ -67,6 +68,7 @@ services: REDIS_URL: redis://redis:6379/0 RS_REDIS_URL: redis://redis:6379/1 RS_STORAGE_URL: "http://localhost:4567" + S3_ENABLED: false depends_on: - ldap - redis