Skip to content

Commit

Permalink
Merge pull request #3458 from manyfold3d/s3-path-style
Browse files Browse the repository at this point in the history
Add option for whether or not to use path-style URLs for non-AWS S3 services
  • Loading branch information
Floppy authored Jan 21, 2025
2 parents 3ff621f + 00a44c5 commit 0cb5f92
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def checkbox_input_row(form, name, options = {})
content_tag(:div, class: "form-switch") do
safe_join [
form.check_box(name, options.merge(class: "form-check-input form-check-inline")),
errors_for(form.object, name)
errors_for(form.object, name),
(options[:help] ? content_tag(:span, class: "form-text") { options[:help] } : nil)
].compact
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/library.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def storage
region: s3_region,
access_key_id: s3_access_key_id,
secret_access_key: s3_secret_access_key,
force_path_style: s3_endpoint.present?,
force_path_style: s3_endpoint.present? && s3_path_style,
use_accelerate_endpoint: s3_endpoint.blank?
)
else
Expand Down
1 change: 1 addition & 0 deletions app/views/libraries/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<%= text_input_row form, :s3_region, autocomplete: false %>
<%= text_input_row form, :s3_access_key_id, autocomplete: false %>
<%= password_input_row form, :s3_secret_access_key, autocomplete: false %>
<%= checkbox_input_row form, :s3_path_style, help: t(".s3_path_style.help") %>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ en:
s3_access_key_id: Access Key ID
s3_bucket: Bucket Name
s3_endpoint: Endpoint URL
s3_path_style: Use path-style URLs
s3_region: Region
s3_secret_access_key: Secret Access Key
storage_service: Storage Service
Expand Down
2 changes: 2 additions & 0 deletions config/locales/libraries/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ en:
s3_description_html: Manyfold can use any S3-compatible object storage for your library; this could be from any of a large number of <a href="https://github.com/okhosting/awesome-storage?tab=readme-ov-file#s3-compatible-file-servers">open source</a> or <a href="https://www.storageprovider.info/blog/all-s3-storage-providers/">commercial</a> services.
s3_endpoint:
help: Optional; only needed for S3-compatible services, not AWS.
s3_path_style:
help: Disable to use vhost-style bucket URLs. Only used for S3-compatible services, not AWS.
tag_regex:
help: Check for models missing tags matching these regex.
general:
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20250121105010_add_s3_path_style_to_library.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddS3PathStyleToLibrary < ActiveRecord::Migration[7.2]
def change
add_column :libraries, :s3_path_style, :boolean, default: true, null: false
end
end
3 changes: 2 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0cb5f92

Please sign in to comment.