mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Merge branch 'master' into dev
This commit is contained in:
commit
6cc8ba0fbd
5 changed files with 18 additions and 7 deletions
|
|
@ -87,7 +87,13 @@ class Users::ImportData
|
||||||
Rails.logger.debug "Extracting #{entry.name} to #{extraction_path}"
|
Rails.logger.debug "Extracting #{entry.name} to #{extraction_path}"
|
||||||
|
|
||||||
FileUtils.mkdir_p(File.dirname(extraction_path))
|
FileUtils.mkdir_p(File.dirname(extraction_path))
|
||||||
entry.extract(sanitized_name, destination_directory: @import_directory)
|
|
||||||
|
# Manual extraction to bypass size validation for large files
|
||||||
|
entry.get_input_stream do |input|
|
||||||
|
File.open(extraction_path, 'wb') do |output|
|
||||||
|
IO.copy_stream(input, output)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,6 @@ module Dawarich
|
||||||
|
|
||||||
config.active_job.queue_adapter = :sidekiq
|
config.active_job.queue_adapter = :sidekiq
|
||||||
|
|
||||||
config.action_mailer.preview_paths << "#{Rails.root}/spec/mailers/previews"
|
config.action_mailer.preview_paths << "#{Rails.root.join('spec/mailers/previews')}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ Rails.application.configure do
|
||||||
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
||||||
# ]
|
# ]
|
||||||
# Skip DNS rebinding protection for the health check endpoint.
|
# Skip DNS rebinding protection for the health check endpoint.
|
||||||
config.host_authorization = { exclude: ->(request) { request.path == "/api/v1/health" } }
|
config.host_authorization = { exclude: ->(request) { request.path == '/api/v1/health' } }
|
||||||
hosts = ENV.fetch('APPLICATION_HOSTS', 'localhost').split(',').map(&:strip)
|
hosts = ENV.fetch('APPLICATION_HOSTS', 'localhost').split(',').map(&:strip)
|
||||||
|
|
||||||
config.action_mailer.default_url_options = { host: ENV['DOMAIN'] }
|
config.action_mailer.default_url_options = { host: ENV['DOMAIN'] }
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,17 @@
|
||||||
|
|
||||||
require 'aws-sdk-core'
|
require 'aws-sdk-core'
|
||||||
|
|
||||||
|
# Support both AWS_ENDPOINT and AWS_ENDPOINT_URL for backwards compatibility
|
||||||
|
endpoint_url = ENV['AWS_ENDPOINT_URL'] || ENV['AWS_ENDPOINT']
|
||||||
|
|
||||||
if ENV['AWS_ACCESS_KEY_ID'] &&
|
if ENV['AWS_ACCESS_KEY_ID'] &&
|
||||||
ENV['AWS_SECRET_ACCESS_KEY'] &&
|
ENV['AWS_SECRET_ACCESS_KEY'] &&
|
||||||
ENV['AWS_REGION'] &&
|
ENV['AWS_REGION'] &&
|
||||||
ENV['AWS_ENDPOINT']
|
endpoint_url
|
||||||
Aws.config.update(
|
Aws.config.update(
|
||||||
{
|
{
|
||||||
region: ENV['AWS_REGION'],
|
region: ENV['AWS_REGION'],
|
||||||
endpoint: ENV['AWS_ENDPOINT'],
|
endpoint: endpoint_url,
|
||||||
credentials: Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'])
|
credentials: Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'])
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,16 @@ local:
|
||||||
root: <%= Rails.root.join("storage") %>
|
root: <%= Rails.root.join("storage") %>
|
||||||
|
|
||||||
# Only load S3 config if not in test environment
|
# Only load S3 config if not in test environment
|
||||||
<% if !Rails.env.test? && ENV['AWS_ACCESS_KEY_ID'] && ENV['AWS_SECRET_ACCESS_KEY'] && ENV['AWS_REGION'] && ENV['AWS_BUCKET'] && ENV['AWS_ENDPOINT_URL'] %>
|
# Support both AWS_ENDPOINT and AWS_ENDPOINT_URL for backwards compatibility
|
||||||
|
<% endpoint_url = ENV['AWS_ENDPOINT_URL'] || ENV['AWS_ENDPOINT'] %>
|
||||||
|
<% if !Rails.env.test? && ENV['AWS_ACCESS_KEY_ID'] && ENV['AWS_SECRET_ACCESS_KEY'] && ENV['AWS_REGION'] && ENV['AWS_BUCKET'] && endpoint_url %>
|
||||||
s3:
|
s3:
|
||||||
service: S3
|
service: S3
|
||||||
access_key_id: <%= ENV.fetch("AWS_ACCESS_KEY_ID") %>
|
access_key_id: <%= ENV.fetch("AWS_ACCESS_KEY_ID") %>
|
||||||
secret_access_key: <%= ENV.fetch("AWS_SECRET_ACCESS_KEY") %>
|
secret_access_key: <%= ENV.fetch("AWS_SECRET_ACCESS_KEY") %>
|
||||||
region: <%= ENV.fetch("AWS_REGION") %>
|
region: <%= ENV.fetch("AWS_REGION") %>
|
||||||
bucket: <%= ENV.fetch("AWS_BUCKET") %>
|
bucket: <%= ENV.fetch("AWS_BUCKET") %>
|
||||||
endpoint: <%= ENV.fetch("AWS_ENDPOINT_URL") %>
|
endpoint: <%= endpoint_url %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
# Remember not to checkin your GCS keyfile to a repository
|
# Remember not to checkin your GCS keyfile to a repository
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue