Sha256: 7922b15fcf841679d0e912d9f4570ff4a88b5792b04cc394f780d31c5970cf50
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true require 'sidekiq' require 'sidekiq/prometheus/exporter' config = {} config[:url] = ENV['REDIS_URL'] if ENV.key?('REDIS_URL') unless config.key?(:url) scheme = (ENV.fetch('REDIS_SSL', 'false') == 'true') ? 'rediss' : 'redis' host = ENV.fetch('REDIS_HOST', 'localhost') port = ENV.fetch('REDIS_PORT', 6379) db_number = ENV.fetch('REDIS_DB_NUMBER', 0) password = ":#{ENV['REDIS_PASSWORD']}" if ENV.key?('REDIS_PASSWORD') config[:url] = "#{scheme}://#{password}@#{host}:#{port}/#{db_number}" end if ENV.key?('REDIS_NAMESPACE') require 'redis-namespace' config[:namespace] = ENV['REDIS_NAMESPACE'] end if ENV.key?('REDIS_SENTINELS') require 'uri' config[:role] = ENV.fetch('REDIS_SENTINEL_ROLE', :master).to_sym config[:sentinels] = ENV['REDIS_SENTINELS'].split(',').map do |url| uri = URI.parse(url.strip) cfg = {host: uri.host || 'localhost', port: uri.port || 26379} # rubocop:disable Style/NumericLiterals cfg[:password] = ":#{uri.password}" if uri.password cfg end end config[:id] = nil if ENV.key?('REDIS_DISABLE_CLIENT_ID') Sidekiq.configure_client { |client| client.redis = config } run Sidekiq::Prometheus::Exporter.to_app
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-prometheus-exporter-0.2.0 | docker/config.ru |
sidekiq-prometheus-exporter-0.1.17 | docker/config.ru |
sidekiq-prometheus-exporter-0.1.16 | docker/config.ru |