config/config_loader.rb
def load_app_config
    default_configs = read_yaml_file(DEFAULT_CONFIGS)
    user_configs = read_yaml_file(USER_CONFIGS)
    environment_configs = Maybe(ENV).or_else({})

    # Order: default, user, env
    config_order = [default_configs, user_configs, environment_configs]

    configs = config_order.inject { |a, b| a.merge(b) }
    OpenStruct.new(configs.symbolize_keys)
  end
# Load configurations in order:
# - default
# - user
# - env
#
# User configs override default configs and env configs override both user and default configs
Load configurations in order:
default
user
env

User configs override default configs and env configs override both user and default configs
Load configurations in order : default user env User configs override default configs and env configs override both user and default configs
def load_app_config
    default_configs = read_yaml_file(DEFAULT_CONFIGS)
    user_configs = read_yaml_file(USER_CONFIGS)
    environment_configs = Maybe(ENV).or_else({})
    config_order = [default_configs, user_configs, environment_configs]
    configs = config_order.inject { |a, b| a.merge(b) }
    OpenStruct.new(configs.symbolize_keys)
  end
def load_app_config default_configs = read_yaml_file ( DEFAULT_CONFIGS ) user_configs = read_yaml_file ( USER_CONFIGS ) environment_configs = Maybe ( ENV ) . or_else ( { } ) config_order = [ default_configs , user_configs , environment_configs ] configs = config_order . inject { | a , b | a . merge ( b ) } OpenStruct . new ( configs . symbolize_keys ) end
Load configurations in order:
 default
 user
 env
Load configurations in order : default user env
# Order: default, user, env