Sha256: a0c8fb4c6da2bd1ef91afc75493cf2c3aef00db624d65a37ea0434d1a8276391
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
require 'itrigga/config/configuration' raise ArgumentError.new("you must define ITRIGGA_APP_NAME if you're going to use itrigga/config/environment") unless defined?(ITRIGGA_APP_NAME) puts "initialising itrigga-config for '#{ITRIGGA_APP_NAME}' app" app_name_upper = ITRIGGA_APP_NAME.upcase app_name_lower = ITRIGGA_APP_NAME.downcase config_file_env_var_name = "#{app_name_upper}_CONFIG_FILE" param = ARGV.find{|a| a.match(/--#{app_name_lower}-config-file=(.*)/)} given_file = param ? param.gsub(/--#{app_name_lower}-config-file=(.*)/, '\1') : nil ITRIGGA_CONFIG = Itrigga::Config::Configuration.instance() [ given_file, ENV["#{app_name_upper}_CONFIG_FILE"], "/etc/#{app_name_lower}_config_file" ].compact.each { |f| if File.exists?(f) true_path = (File.symlink?(f) ? File.readlink(f) : f) puts "loading #{app_name_lower} config file #{true_path}" ITRIGGA_CONFIG.from_file(true_path) break end } # silence warnings, before we load the convenient Rails silence_warnings method: old_verbose = $VERBOSE $VERBOSE = false begin ITRIGGA_CONFIG.constants.each { |k,v| eval("#{k}='#{v}'") } ensure $VERBOSE = old_verbose end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
itrigga-config-0.0.3 | lib/itrigga/config/environment.rb |