Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production Email Settings #134

Merged
merged 4 commits into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def to_s
email
end

def is_admin
has_role?(:admin) || has_role?(:admin, Site.instance)
end

def is_superadmin
has_role? :superadmin
end
Expand Down
1 change: 1 addition & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
config.active_job.queue_adapter = ENV.fetch('HYRAX_ACTIVE_JOB_QUEUE', 'sidekiq')
# config.active_job.queue_name_prefix = "hyku_#{Rails.env}"

config.action_mailer.default_options = { from: ENV.fetch('HYKU_CONTACT_EMAIL', '[email protected]') }
if ENV['SMTP_ENABLED'].present? && ENV['SMTP_ENABLED'].to_s == 'true'
config.action_mailer.smtp_settings = {
user_name: ENV['SMTP_USER_NAME'],
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/mailboxer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
config.uses_emails = true

#Configures the default from for emails sent for Messages and Notifications
config.default_from = "no-reply@mailboxer.com"
config.default_from = ENV.fetch('HYKU_CONTACT_EMAIL', 'changeme@example.com')

#Configures the methods needed by mailboxer
config.email_method = :mailboxer_email
Expand Down
6 changes: 3 additions & 3 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

concern :iiif_search, BlacklightIiifSearch::Routes.new
concern :oai_provider, BlacklightOaiProvider::Routes.new

mount Hyrax::IiifAv::Engine, at: '/'
mount Riiif::Engine => 'images', as: :riiif if Hyrax.config.iiif_image_server?

authenticate :user, lambda { |u| u.is_superadmin } do
mount Sidekiq::Web => '/sidekiq'
authenticate :user, lambda { |u| u.is_superadmin || u.is_admin } do
mount Sidekiq::Web => '/jobs'
end

if ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYKU_MULTITENANT', false))
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ services:

web:
<<: *app
# Uncomment command to access container with out starting Rails. Useful for debugging
# command: sleep infinity
# command: sh -l -c "bundle && bundle exec rails s -b 0.0.0.0"
environment:
- VIRTUAL_PORT=3000
- VIRTUAL_HOST=.hyku.test
Expand Down
6 changes: 3 additions & 3 deletions ops/production-deploy.tmpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ extraEnvVars: &envVars
- name: HYKU_BULKRAX_ENABLED
value: 'true'
- name: HYKU_CONTACT_EMAIL
value: [email protected]
value: [email protected]
- name: HYKU_DEFAULT_HOST
value: "%{tenant}.ir.atla.com"
- name: HYKU_FILE_ACL
Expand Down Expand Up @@ -151,13 +151,13 @@ extraEnvVars: &envVars
- name: SMTP_ADDRESS
value: email-smtp.us-east-1.amazonaws.com
- name: SMTP_DOMAIN
value: atla.com
value: atlamail.org
- name: SMTP_ENABLED
value: 'true'
- name: SMTP_PASSWORD
value: $SMTP_PASSWORD
- name: SMTP_PORT
value: '465'
value: '587'
- name: SMTP_STARTTLS
value: 'true'
- name: SMTP_TYPE
Expand Down
Loading