From ef85e8c7b346588a5e6ad0df7ddeb1046977c61a Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 14 Oct 2021 18:39:05 +0100 Subject: [PATCH] Make the storage service to use for avatars configurable --- app/models/user.rb | 2 +- config/settings.yml | 2 ++ config/settings/test.yml | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 8b8f31676..023604801 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -87,7 +87,7 @@ class User < ApplicationRecord scope :active, -> { where(:status => %w[active confirmed]) } scope :identifiable, -> { where(:data_public => true) } - has_one_attached :avatar + has_one_attached :avatar, :service => Settings.avatar_storage validates :display_name, :presence => true, :length => 3..255, :exclusion => %w[new terms save confirm confirm-email go_public reset-password forgot-password suspended] diff --git a/config/settings.yml b/config/settings.yml index 801e8f2d1..929df7b8a 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -132,3 +132,5 @@ smtp_enable_starttls_auto: false smtp_authentication: null smtp_user_name: null smtp_password: null +# Storage services +avatar_storage: "local" diff --git a/config/settings/test.yml b/config/settings/test.yml index d3952e27b..77afe95ee 100644 --- a/config/settings/test.yml +++ b/config/settings/test.yml @@ -19,3 +19,5 @@ wikipedia_auth_id: "dummy" wikipedia_auth_secret: "dummy" # Server URL for testing server_url: "test.host" +# Storage services for testing +avatar_storage: "test" -- 2.39.5