Skip to content

Commit

Permalink
Adjust config usage #34
Browse files Browse the repository at this point in the history
Rails 7 simplifies usage of custom configuration loaded
with `config_for`. This change makes use of these
simplifications.
  • Loading branch information
oneiros committed Jun 2, 2022
1 parent 5ccf243 commit 2035370
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/models/hiera_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def lookup_options(facts)
private

def config_dir
@config_dir ||= Rails.configuration.hdm["config_dir"]
@config_dir ||= Rails.configuration.hdm.config_dir
end

def config
Expand Down
2 changes: 1 addition & 1 deletion app/models/hiera_data/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def initialize(base_path)
private

def load_content
full_path = @base_path.join(Rails.configuration.hdm["hiera_config_file"] || "hiera.yaml")
full_path = @base_path.join(Rails.configuration.hdm.hiera_config_file || "hiera.yaml")
defaults = Puppet::Pops::Lookup::HieraConfigV5::DEFAULT_CONFIG_HASH
config = if File.exist?(full_path)
parsed_file = YAML.load(File.read(full_path))
Expand Down
2 changes: 1 addition & 1 deletion app/models/hiera_data/data_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def setup_git_location
end

def matching_git_location
Rails.configuration.hdm["git_data"]&.find do |git_data|
Rails.configuration.hdm.git_data&.find do |git_data|
replaces_datadir = Interpolation
.interpolate_facts(path: git_data[:datadir], facts: @facts)
replaces_datadir << "/" unless replaces_datadir.last == "/"
Expand Down
2 changes: 1 addition & 1 deletion app/models/hierarchy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def eyaml?

def encryption_possible?
eyaml? &&
Rails.configuration.hdm['allow_encryption'] &&
Rails.configuration.hdm.allow_encryption &&
@encryptable
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/value.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def file_present?
end

def file_writable?
!Rails.configuration.hdm['read_only'] && @file_writable
!Rails.configuration.hdm.read_only && @file_writable
end

def key_present?
Expand Down
2 changes: 1 addition & 1 deletion app/services/puppet_db_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def environments
end

def client
connection_hash = Rails.configuration.hdm["puppet_db"].with_indifferent_access
connection_hash = Rails.configuration.hdm.puppet_db

PuppetDB::Client.new(connection_hash)
end
Expand Down

0 comments on commit 2035370

Please sign in to comment.