Class: AnyCable::Config
- Inherits:
-
Anyway::Config
- Object
- Anyway::Config
- AnyCable::Config
- Defined in:
- lib/anycable/config.rb
Overview
AnyCable configuration.
Constant Summary collapse
- DefaultHostWrapper =
Class.new(String)
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?
51 52 53 |
# File 'lib/anycable/config.rb', line 51 def debug @debug != false end |
#http_health_port_provided? ⇒ Boolean
57 58 59 |
# File 'lib/anycable/config.rb', line 57 def http_health_port_provided? !http_health_port.nil? && http_health_port != "" end |
#log_grpc ⇒ Object
47 48 49 |
# File 'lib/anycable/config.rb', line 47 def log_grpc debug || @log_grpc end |
#log_level ⇒ Object
43 44 45 |
# File 'lib/anycable/config.rb', line 43 def log_level debug ? :debug : @log_level end |
#to_grpc_params ⇒ Object
Build gRPC server parameters
62 63 64 65 66 67 68 69 70 |
# File 'lib/anycable/config.rb', line 62 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
87 88 89 90 91 92 |
# File 'lib/anycable/config.rb', line 87 def to_http_health_params { port: http_health_port, path: http_health_path } end |
#to_redis_params ⇒ Object
Build Redis parameters
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/anycable/config.rb', line 73 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 |