Sha256: 7f1342ea5c021990998bd0903467160015584930f91c1eb71a9b90059b4aef1c
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
require 'active_support/configurable' require 'uri' module SqlMonitor class Config include ActiveSupport::Configurable config_accessor :redis_host, :tracked_paths, :tracked_sql_command, :output_path, :enabled, :redis_db, :release_version, :save_at_exit class << self def apply_defaults self.redis_host = redis_host.nil? ? 'localhost' : URI.parse(redis_host).host self.redis_db = redis_db.nil? ? 11 : redis_db self.release_version = release_version.nil? ? (0...50).map { ('a'..'z').to_a[rand(26)] }.join : release_version self.save_at_exit = save_at_exit.nil? ? false : save_at_exit self.enabled = enabled.nil? ? false : enabled self.tracked_paths ||= %w(app lib) self.tracked_sql_command ||= %w(SELECT INSERT UPDATE DELETE) self.output_path ||= begin if defined?(::Rails) && ::Rails.root File.join(::Rails.root.to_s, 'tmp') else 'tmp' end end self end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sql_monitor-0.1.2 | lib/sql_monitor/config.rb |
sql_monitor-0.1.1 | lib/sql_monitor/config.rb |
sql_monitor-0.1.0 | lib/sql_monitor/config.rb |