Skip to content

Commit

Permalink
Use new syntax for psych 4
Browse files Browse the repository at this point in the history
- Psych 4 has changed their syntax so account for that
- Taken from: AlchemyCMS/alchemy_cms@v6.0.0...v6.0.5 which I got too from here; AlchemyCMS#2361
  • Loading branch information
sajoku committed Mar 28, 2023
1 parent 1683524 commit ef260bc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/alchemy/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def show

# Alchemy default configuration
def alchemy_config
read_file(File.join(File.dirname(__FILE__), '..', '..', 'config/alchemy/config.yml'))
read_file(File.join(File.dirname(__FILE__), "..", "..", "config/alchemy/config.yml"))
end

# Application specific configuration
Expand All @@ -46,15 +46,19 @@ def env_specific_config
# If it does not exist, or its empty, it returns an empty Hash.
#
def read_file(file)
YAML.safe_load(ERB.new(File.read(file)).result, YAML_WHITELIST_CLASSES, [], true) || {}
YAML.safe_load(
ERB.new(File.read(file)).result,
permitted_classes: YAML_PERMITTED_CLASSES,
aliases: true
) || {}
rescue Errno::ENOENT
{}
end

# Merges all given configs together
#
def merge_configs!(*config_files)
raise LoadError, 'No Alchemy config file found!' if config_files.map(&:blank?).all?
raise LoadError, "No Alchemy config file found!" if config_files.map(&:blank?).all?
config = {}
config_files.each { |h| config.merge!(h.stringify_keys!) }
config
Expand Down

0 comments on commit ef260bc

Please sign in to comment.