mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-22 22:59:39 +02:00
Safe load yaml files
This commit is contained in:
parent
47288a1629
commit
09b269273a
2 changed files with 12 additions and 2 deletions
|
@ -1,5 +1,10 @@
|
||||||
# Load exchanges from YAML configuration
|
# Load exchanges from YAML configuration
|
||||||
exchanges_config = YAML.load_file(Rails.root.join('config', 'exchanges.yml'))
|
exchanges_config = YAML.safe_load(
|
||||||
|
File.read(Rails.root.join('config', 'exchanges.yml')),
|
||||||
|
permitted_classes: [],
|
||||||
|
permitted_symbols: [],
|
||||||
|
aliases: true
|
||||||
|
)
|
||||||
|
|
||||||
exchanges_config.each do |exchange|
|
exchanges_config.each do |exchange|
|
||||||
next unless exchange['mic'].present? # Skip any invalid entries
|
next unless exchange['mic'].present? # Skip any invalid entries
|
||||||
|
|
|
@ -23,7 +23,12 @@ class Money::Currency
|
||||||
end
|
end
|
||||||
|
|
||||||
def all
|
def all
|
||||||
@all ||= YAML.load_file(CURRENCIES_FILE_PATH)
|
@all ||= YAML.safe_load(
|
||||||
|
File.read(CURRENCIES_FILE_PATH),
|
||||||
|
permitted_classes: [],
|
||||||
|
permitted_symbols: [],
|
||||||
|
aliases: true
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def all_instances
|
def all_instances
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue