File tree Expand file tree Collapse file tree 3 files changed +37
-29
lines changed Expand file tree Collapse file tree 3 files changed +37
-29
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,14 @@ module DownloadableFile
33 extend ActiveSupport ::Concern
44
55 included do
6- has_attached_file :file , Settings . paperclip . to_hash . merge ( validate_media_type : false )
6+ has_attached_file :file , PaperclipSettings . config . to_hash . merge ( validate_media_type : false )
77
88 # TODO: Limit attachment types for safe uploads
99 do_not_validate_attachment_file_type :file
1010 end
1111
1212 def download_url
13- if fog?
13+ if PaperclipSettings . fog?
1414 # This is a workaround due to a bug or limitation in fog to generate a
1515 # private, expiring URL and have it force a download.
1616 #
@@ -31,10 +31,4 @@ def download_url
3131 end
3232 end
3333
34- private
35-
36- def fog?
37- Settings . paperclip . storage == "fog"
38- end
39-
4034end
Original file line number Diff line number Diff line change 1313Paperclip . options [ :content_type_mappings ] = {
1414 xls : "CDF V2 Document, No summary info" ,
1515}
16+
17+ class PaperclipSettings
18+
19+ def self . config
20+ secrets = Hash ( Rails . application . secrets . paperclip ) . symbolize_keys
21+ Settings . paperclip . to_hash . merge ( secrets )
22+ end
23+
24+ def self . fog?
25+ config [ :storage ] == "fog"
26+ end
27+
28+ end
Original file line number Diff line number Diff line change 11development:
22 secret_key_base: ~
33
4+ # You should change this if you want to be able to access the API
5+ api:
6+ basic_auth_name: <%= SecureRandom.hex %>
7+ basic_auth_password: <%= SecureRandom.hex %>
8+
9+ # You should change this if you want to be able to access the SecureRooms API
10+ secure_rooms_api:
11+ basic_auth_name: <%= SecureRandom.hex %>
12+ basic_auth_password: <%= SecureRandom.hex %>
13+
14+ # Uncomment these lines if you wish to use S3 in your application.
15+ # paperclip:
16+ # storage: fog
17+ # fog_credentials:
18+ # provider: AWS
19+ # aws_access_key_id: Your-Key-Here
20+ # aws_secret_access_key: Your-Key-Here
21+ # fog_directory: Your-Bucket-Name-Here
22+ # fog_public: false
23+ # path: ":class/:attachment/:id_partition/:style/:safe_filename"
24+
25+
426test:
527 secret_key_base: needs_a_value_for_ci
628
729production:
830 secret_key_base: ~
931 rollbar: ~
10-
11- # You should change this if you want to be able to access the API
12- api:
13- basic_auth_name: <%= SecureRandom.hex %>
14- basic_auth_password: <%= SecureRandom.hex %>
15-
16- # You should change this if you want to be able to access the SecureRooms API
17- secure_rooms_api:
18- basic_auth_name: <%= SecureRandom.hex %>
19- basic_auth_password: <%= SecureRandom.hex %>
20-
21- # Uncomment these lines if you wish to use S3 in your application.
22- # paperclip:
23- # storage: fog
24- # fog_credentials:
25- # provider: AWS
26- # aws_access_key_id: Your-Key-Here
27- # aws_secret_access_key: Your-Key-Here
28- # fog_directory: Your-Bucket-Name-Here
29- # fog_public: false
30- # path: ":class/:attachment/:id_partition/:style/:safe_filename"
You can’t perform that action at this time.
0 commit comments