Skip to content

Commit

Permalink
Merge pull request #1155 from SUSE/move-registry-config-engine
Browse files Browse the repository at this point in the history
Move registry engine config from core config to its engine
  • Loading branch information
rjschwei committed May 15, 2024
2 parents 56155fe + 25dabe9 commit 057e696
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 21 deletions.
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

0 comments on commit 057e696

Please sign in to comment.