Sha256: 002a4371ef3da10a292f09242d1a7c4b538835b1db81d3b97b0e3220aec4093a

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module SidekiqAlive
  class Config
    include Singleton

    attr_accessor :host,
                  :port,
                  :path,
                  :liveness_key,
                  :time_to_live,
                  :callback,
                  :registered_instance_key,
                  :queue_prefix,
                  :server,
                  :custom_liveness_probe

    def initialize
      set_defaults
    end

    def set_defaults
      @host = ENV.fetch('SIDEKIQ_ALIVE_HOST', '0.0.0.0')
      @port = ENV.fetch('SIDEKIQ_ALIVE_PORT', 7433)
      @path = ENV.fetch('SIDEKIQ_ALIVE_PATH', '/')
      @liveness_key = 'SIDEKIQ::LIVENESS_PROBE_TIMESTAMP'
      @time_to_live = 10 * 60
      @callback = proc {}
      @registered_instance_key = 'SIDEKIQ_REGISTERED_INSTANCE'
      @queue_prefix = :sidekiq_alive
      @server = ENV.fetch('SIDEKIQ_ALIVE_SERVER', 'webrick')
      @custom_liveness_probe = proc { true }
    end

    def registration_ttl
      @registration_ttl || time_to_live + 60
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sidekiq_alive-2.1.7 lib/sidekiq_alive/config.rb
sidekiq_alive-2.1.6 lib/sidekiq_alive/config.rb
sidekiq_alive-2.1.5 lib/sidekiq_alive/config.rb
sidekiq_alive-2.1.4 lib/sidekiq_alive/config.rb
sidekiq_alive-2.1.3 lib/sidekiq_alive/config.rb
sidekiq_alive-2.1.2 lib/sidekiq_alive/config.rb