Sha256: 076cd034ddc2fc3c1b15cf07791897be4f13ade8fd430cd451c0f8316d2b66ab

Contents?: true

Size: 781 Bytes

Versions: 3

Compression:

Stored size: 781 Bytes

Contents

require 'yaml'

module HerokuResqueAutoScale
  module Config
    extend self

    CONFIG_FILE_NAME = 'scaler_config.yml'
    
    def mode
      @mode ||= config['mode']
    end

    def thresholds
      @thresholds ||= config['thresholds']
    end

    def environments
      @environments ||= config['environments']
    end

    def worker_name
      @worker_name ||= config['worker_name']
    end

    private

    def config
      @config ||= YAML.load_file(config_route_path)
    end

    def config_route_path
      if defined?(Rails) && File.exists?(Rails.root.join("config/#{CONFIG_FILE_NAME}").to_s)
        Rails.root.join("config/#{CONFIG_FILE_NAME}").to_s
      else
        File.expand_path("../../../config/#{CONFIG_FILE_NAME}", __FILE__)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
heroku-resque-workers-scaler-0.3.2 lib/heroku-resque-workers-scaler/config.rb
heroku-resque-workers-scaler-0.3.1 lib/heroku-resque-workers-scaler/config.rb
heroku-resque-workers-scaler-0.3.0 lib/heroku-resque-workers-scaler/config.rb