Skip to content

Commit

Permalink
Merge branch 'main' into hide_pdf_pages_from_public_work_show_page
Browse files Browse the repository at this point in the history
  • Loading branch information
cziaarm committed Sep 25, 2023
2 parents 4d08c12 + 6e0af5f commit 232e9da
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
14 changes: 14 additions & 0 deletions app/controllers/hyrax/downloads_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# OVERRIDE Hyrax 2.9.6 for IRUS Analytics

require 'aws-sdk-s3'

module Hyrax
class DownloadsController < ApplicationController
include Hydra::Controller::DownloadBehavior
Expand Down Expand Up @@ -36,6 +38,18 @@ def item_identifier_for_irus_analytics

private

# OVERRIDE Hyrax 2.9.6 allow downloading directly from S3
def send_file_contents
if ENV['S3_DOWNLOADS']
s3_object = Aws::S3::Object.new(ENV['AWS_BUCKET'], file.digest.first.to_s.gsub('urn:sha1:', ''))
redirect_to s3_object.presigned_url(:get, expires_in: 3600, response_content_disposition: "attachment\; filename=#{file.original_name}")
else
self.status = 200
prepare_file_headers
stream_body file.stream
end
end

# Override the Hydra::Controller::DownloadBehavior#content_options so that
# we have an attachement rather than 'inline'
def content_options
Expand Down
10 changes: 10 additions & 0 deletions ops/production-deploy.tmpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,16 @@ extraEnvVars: &envVars
value: "1"
- name: EXTERNAL_IIIF_URL
value: https://dudgkgvsbllzg.cloudfront.net/iiif/2
- name: AWS_BUCKET
value: "samvera-fcrepo-bl"
- name: AWS_ACCESS_KEY_ID
value: $AWS_ACCESS_KEY_ID
- name: AWS_SECRET_ACCESS_KEY
value: $AWS_SECRET_ACCESS_KEY
- name: AWS_REGION
value: 'eu-west-1'
- name: S3_DOWNLOADS
value: "true"

worker:
replicaCount: 1
Expand Down
2 changes: 1 addition & 1 deletion ops/provision/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ resource "helm_release" "cert_manager" {
name = "cert-manager"
namespace = "cert-manager"
create_namespace = true
version = "1.4.0"
version = "1.12.0"
repository = "https://charts.jetstack.io"
chart = "cert-manager"

Expand Down
10 changes: 10 additions & 0 deletions ops/staging-deploy.tmpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ ingress:
secretName: notch8cloudstaging

extraEnvVars: &envVars
- name: AWS_BUCKET
value: "samvera-fcrepo-staging-bl"
- name: AWS_ACCESS_KEY_ID
value: $AWS_ACCESS_KEY_ID
- name: AWS_SECRET_ACCESS_KEY
value: $AWS_SECRET_ACCESS_KEY
- name: AWS_REGION
value: 'eu-west-1'
- name: CONFDIR
value: "/app/samvera/hyrax-webapp/solr/config"
- name: DATABASE_ADAPTER
Expand Down Expand Up @@ -129,6 +137,8 @@ extraEnvVars: &envVars
value: "true"
- name: HYKU_ROOT_HOST
value: bl-staging.notch8.cloud
- name: S3_DOWNLOADS
value: "true"
- name: SMTP_ADDRESS
value: smtp.mailtrap.io
- name: SMTP_DOMAIN
Expand Down

0 comments on commit 232e9da

Please sign in to comment.