Skip to content
Snippets Groups Projects
Select Git revision
  • master default
  • uiUpdates
  • 1.0.0
3 results

config_loader.rb

Blame
  • config_loader.rb 407 B
    ROOT = File.expand_path(File.dirname(__FILE__)) << '/..'
    $LOAD_PATH.unshift(ROOT)
    
    require 'json'
    
    config = Hash.new
    
    # read a base config file
    config.merge!(JSON.parse(File.read("#{ROOT}/config/config.json")))
    
    # read a server/env-specific config file if one exists
    if File.exist?("#{ROOT}/config/server.json")
        config.merge!(JSON.parse(File.read("#{ROOT}/config/server.json")))    
    end
    
    CONFIG = config