diff --git a/config/application.rb b/config/application.rb index 197524b91..581f9eac3 100644 --- a/config/application.rb +++ b/config/application.rb @@ -58,19 +58,6 @@ class Application < Rails::Application config.eager_load_paths << Rails.root.join('lib') config.eager_load_paths << Rails.root.join('app', 'validators') - # :nocov: - if defined?(Registry::Engine) && Rails.env.production? - # registry config needed - config.autoloader = :classic - config.registry_private_key = OpenSSL::PKey::RSA.new( - File.read('/etc/rmt/ssl/internal-registry.key') - ) - config.registry_public_key = config.registry_private_key.public_key - config.access_policies = '/etc/rmt/access_policies.yml' - # registry config needed end - end - # :nocov: - # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers # -- all .rb files in that directory are automatically loaded after loading diff --git a/config/environments/test.rb b/config/environments/test.rb index 73c35c725..8a312de06 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -27,14 +27,6 @@ config.action_controller.perform_caching = false config.cache_store = :null_store - # for registry - config.access_policies = 'engines/registry/spec/data/access_policies.yml' - config.registry_private_key = OpenSSL::PKey::RSA.new(2048) - config.registry_public_key = config.registry_private_key.public_key - config.autoload_paths << Rails.root.join('engines/registry/spec/support/') - config.cache_config_file = Rails.root.join('engines/registry/spec/data/rmt-cache-trim.sh') - config.repo_cache_dir = 'repo/cache' - config.registry_cache_dir = 'registry/cache' # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false diff --git a/engines/instance_verification/config/environments/test.rb b/engines/instance_verification/config/environments/test.rb index 2206b411b..13d5f20ae 100644 --- a/engines/instance_verification/config/environments/test.rb +++ b/engines/instance_verification/config/environments/test.rb @@ -6,4 +6,5 @@ Rails.application.configure do config.cache_config_file = Rails.root.join('engines/registry/spec/data/rmt-cache-trim.sh') config.repo_cache_dir = 'repo/cache' + config.registry_cache_dir = 'registry/cache' end diff --git a/engines/registry/config/environments/production.rb b/engines/registry/config/environments/production.rb new file mode 100644 index 000000000..2a5fdb99f --- /dev/null +++ b/engines/registry/config/environments/production.rb @@ -0,0 +1,13 @@ +# :nocov: +module Registry + class Application < Rails::Application + # registry config needed + config.autoloader = :classic + config.registry_private_key = OpenSSL::PKey::RSA.new( + File.read('/etc/rmt/ssl/internal-registry.key') + ) + config.registry_public_key = config.registry_private_key.public_key + config.access_policies = '/etc/rmt/access_policies.yml' + end +end +# :nocov: diff --git a/engines/registry/config/environments/test.rb b/engines/registry/config/environments/test.rb new file mode 100644 index 000000000..d70f4f041 --- /dev/null +++ b/engines/registry/config/environments/test.rb @@ -0,0 +1,11 @@ +# The test environment is used exclusively to run your application's +# test suite. You never need to work with it otherwise. Remember that +# your test database is "scratch space" for the test suite and is wiped +# and recreated between test runs. Don't rely on the data there! + +Rails.application.configure do + config.access_policies = 'engines/registry/spec/data/access_policies.yml' + config.registry_private_key = OpenSSL::PKey::RSA.new(2048) + config.registry_public_key = config.registry_private_key.public_key + config.autoload_paths << Rails.root.join('engines/registry/spec/support/') +end