Skip to content
Snippets Groups Projects
Commit e81305c4 authored by Anusha Ranganathan's avatar Anusha Ranganathan
Browse files

Improving configuration settings

parent d5edf5ce
No related branches found
No related tags found
2 merge requests!19Develop,!7Config modifications
......@@ -15,5 +15,17 @@ module Hyrax3App
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
config.active_job.queue_adapter = :sidekiq
# The locale is set by a query parameter, so if it's not found render 404
config.action_dispatch.rescue_responses.merge!(
'I18n::InvalidLocale' => :not_found
)
config.i18n.default_locale = :en
config.i18n.available_locales = [:en, :de]
config.i18n.fallbacks = [:en]
config.action_dispatch.default_headers['Referrer-Policy'] = 'strict-origin-when-cross-origin'
end
end
......@@ -27,8 +27,8 @@ Rails.application.configure do
config.cache_store = :null_store
end
# Store uploaded files on the local file system (see config/storage.yml for options)
config.active_storage.service = :local
# Use Sidekiq to process background jobs
config.active_job.queue_adapter = :sidekiq
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
......@@ -55,9 +55,12 @@ Rails.application.configure do
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
Rails.application.routes.default_url_options = { host: ENV.fetch('APP_HOST') { 'localhost' } }
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.web_console.whitelisted_ips = ["172.0.0.0/8", '192.168.0.0/16', '127.0.0.1']
config.force_ssl = false
if ENV['APP_HOST'].present?
......
......@@ -17,6 +17,9 @@ Rails.application.configure do
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Use Sidekiq to process background jobs
config.active_job.queue_adapter = :sidekiq
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
......@@ -54,15 +57,41 @@ Rails.application.configure do
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
if ENV["RAILS_FORCE_SSL"].present? && (ENV["RAILS_FORCE_SSL"].to_s.downcase == 'false') then
config.force_ssl = false
Rails.application.routes.default_url_options = \
Hyrax::Engine.routes.default_url_options = \
{protocol: 'http', host: ENV['APP_HOST']}
config.application_url = "http://#{ENV['APP_HOST']}"
else
config.force_ssl = true #default if nothing specified is more secure.
Rails.application.routes.default_url_options = \
Hyrax::Engine.routes.default_url_options = \
{protocol: 'https', host: ENV['APP_HOST']}
config.application_url = "https://#{ENV['APP_HOST']}"
end
# Use the lowest log level to ensure availability of diagnostic information
# Use the lowest log level (:debug) to ensure availability of diagnostic information
# when problems arise.
config.log_level = :info
# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
......@@ -83,33 +112,15 @@ Rails.application.configure do
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
if ENV["RAILS_FORCE_SSL"].present? && (ENV["RAILS_FORCE_SSL"].to_s.downcase == 'false') then
config.force_ssl = false
Rails.application.routes.default_url_options = \
Hyrax::Engine.routes.default_url_options = \
{protocol: 'http', host: ENV['APP_HOST']}
config.application_url = "http://#{ENV['APP_HOST']}"
else
config.force_ssl = true #default if nothing specified is more secure.
Rails.application.routes.default_url_options = \
Hyrax::Engine.routes.default_url_options = \
{protocol: 'https', host: ENV['APP_HOST']}
config.application_url = "https://#{ENV['APP_HOST']}"
end
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: ENV['SMTP_HOST'],
port: ENV['SMTP_PORT'],
enable_starttls_auto: false
}
end
......@@ -15,7 +15,7 @@ Rails.application.configure do
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{1.hour.to_i}"
'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
}
# Show full error reports and disable caching.
......@@ -44,6 +44,9 @@ Rails.application.configure do
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# Don't use redis for storing queued jobs when running tests
config.active_job.queue_adapter = :test
if ENV['APP_HOST'].present?
Rails.application.routes.default_url_options = {protocol: 'http', host: ENV['APP_HOST']}
Hyrax::Engine.routes.default_url_options = {protocol: 'http', host: ENV['APP_HOST']}
......
# frozen_string_literal: true
ClamAV.instance.loaddb if defined? ClamAV
......@@ -62,14 +62,18 @@ Hyrax.config do |config|
# where NOID = 10-character string and UUID = 32-character string w/ hyphens
config.enable_noids = true
# Template for your repository's NOID IDs
# config.noid_template = ".reeddeeddk"
# In a test environment, use the file-based NOID generator to avoid problems with the tables being wiped between tests
if ENV['RAILS_ENV'] == 'test'
puts 'Using file-based NOIDs for tests'
# Template for your repository's NOID IDs
config.noid_template = "tzrb-.zddddd"
# Use the database-backed minter class
# config.noid_minter_class = Noid::Rails::Minter::Db
# Use the database-backed minter class
config.noid_minter_class = Noid::Rails::Minter::File
# Store identifier minter's state in a file for later replayability
# config.minter_statefile = '/tmp/minter-state'
# Store identifier minter's state in a file for later replayability
config.minter_statefile = 'tmp/minter'
end
# Prefix for Redis keys
# config.redis_namespace = "hyrax"
......
# frozen_string_literal: true
require 'redis'
config = YAML.safe_load(ERB.new(IO.read(Rails.root.join('config', 'redis.yml'))).result)[Rails.env].with_indifferent_access
Redis.current = Redis.new(config.merge(thread_safe: true))
# frozen_string_literal: true
ActiveSupport::Reloader.to_prepare do
Riiif::Image.file_resolver = Riiif::HttpFileResolver.new
Riiif::Image.info_service = lambda do |id, _file|
......
# frozen_string_literal: true
config = YAML.safe_load(ERB.new(IO.read(Rails.root + 'config' + 'redis.yml')).result)[Rails.env].with_indifferent_access
redis_config = config.merge(thread_safe: true)
Sidekiq::Logging.logger.level = Logger::WARN if ENV['RAILS_ENV'] == 'production'
redis_conn = { url: "redis://#{config[:host]}:#{config[:port]}/" }
Sidekiq.configure_server do |s|
s.redis = redis_conn
# s.redis = redis_conn
s.redis = redis_config
end
Sidekiq.configure_client do |s|
s.redis = redis_conn
end
\ No newline at end of file
# s.redis = redis_conn
s.redis = redis_config
end
# frozen_string_literal: true
# NOTE: This is a modified version of simple_form's default config file.
# The only changes were to move the input to after the hint and error.
......
# frozen_string_literal: true
# NOTE: This is a modified version of simple_form's default config file.
# The only changes were to move the inputs to after the hints and errors.
......
......@@ -12,6 +12,11 @@ Rails.application.routes.draw do
devise_for :users
mount Hydra::RoleManagement::Engine => '/'
authenticate :user, lambda { |u| u.admin? } do
require 'sidekiq/web'
mount Sidekiq::Web => '/sidekiq'
end
mount Qa::Engine => '/authorities'
mount Hyrax::Engine, at: '/'
resources :welcome, only: 'index'
......@@ -31,9 +36,6 @@ Rails.application.routes.draw do
end
end
authenticate :user, lambda { |u| u.admin? } do
require 'sidekiq/web'
mount Sidekiq::Web => '/sidekiq'
end
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment