Module: Linecook::Config
Constant Summary collapse
- CONFIG_PATH =
File.join(Dir.pwd, 'linecook.yml').freeze
- SECRETS_PATH =
File.join(Dir.pwd, 'secrets.ejson').freeze
- LINECOOK_HOME =
File.('~/.linecook').freeze
- DEFAULT_CONFIG_PATH =
File.join(LINECOOK_HOME, 'config.yml').freeze
Instance Method Summary collapse
Instance Method Details
#config ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/linecook-gem/config.rb', line 19 def config @config ||= begin config_path = ENV['LINECOOK_CONFIG_PATH'] || CONFIG_PATH config = {} config ||= YAML.load(File.read(DEFAULT_CONFIG_PATH)) if File.exist?(DEFAULT_CONFIG_PATH) config.deep_merge!(YAML.load(File.read(config_path))) if File.exist?(config_path) (config || {}).deep_symbolize_keys! config.deep_merge!(secrets) end end |