Class: AnyCable::Config
- Inherits:
-
Anyway::Config
- Object
- Anyway::Config
- AnyCable::Config
- Defined in:
- lib/anycable/config.rb
Overview
AnyCable configuration.
Instance Method Summary collapse
- #debug ⇒ Object (also: #debug?)
- #http_health_port_provided? ⇒ Boolean
- #log_grpc ⇒ Object
- #log_level ⇒ Object
-
#to_grpc_params ⇒ Object
Build gRPC server parameters.
-
#to_http_health_params ⇒ Object
Build HTTP health server parameters.
-
#to_redis_params ⇒ Object
Build Redis parameters.
Instance Method Details
#debug ⇒ Object Also known as: debug?
49 50 51 |
# File 'lib/anycable/config.rb', line 49 def debug @debug != false end |
#http_health_port_provided? ⇒ Boolean
55 56 57 |
# File 'lib/anycable/config.rb', line 55 def http_health_port_provided? !http_health_port.nil? && http_health_port != "" end |
#log_grpc ⇒ Object
45 46 47 |
# File 'lib/anycable/config.rb', line 45 def log_grpc debug || @log_grpc end |
#log_level ⇒ Object
41 42 43 |
# File 'lib/anycable/config.rb', line 41 def log_level debug ? :debug : @log_level end |
#to_grpc_params ⇒ Object
Build gRPC server parameters
60 61 62 63 64 65 66 67 68 |
# File 'lib/anycable/config.rb', line 60 def to_grpc_params { pool_size: rpc_pool_size, max_waiting_requests: rpc_max_waiting_requests, poll_period: rpc_poll_period, pool_keep_alive: rpc_pool_keep_alive, server_args: rpc_server_args } end |
#to_http_health_params ⇒ Object
Build HTTP health server parameters
85 86 87 88 89 90 |
# File 'lib/anycable/config.rb', line 85 def to_http_health_params { port: http_health_port, path: http_health_path } end |
#to_redis_params ⇒ Object
Build Redis parameters
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/anycable/config.rb', line 71 def to_redis_params { url: redis_url }.tap do |params| next if redis_sentinels.nil? raise ArgumentError, "redis_sentinels must be an array; got #{redis_sentinels}" unless redis_sentinels.is_a?(Array) next if redis_sentinels.empty? params[:sentinels] = redis_sentinels.map(&method(:parse_sentinel)) end end |