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

Move registry engine config from core config to its engine #1155

Merged
merged 2 commits into from
May 15, 2024
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
13 changes: 0 additions & 13 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions engines/instance_verification/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions engines/registry/config/environments/production.rb
Original file line number Diff line number Diff line change
@@ -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:
11 changes: 11 additions & 0 deletions engines/registry/config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -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