module Kumonos::Routes

Generate routes configuration

Constants

Vhost

Public Class Methods

generate(definition) click to toggle source
# File lib/kumonos/routes.rb, line 7
def generate(definition)
  {
    validate_clusters: false,
    virtual_hosts: definition['dependencies'].map { |s| Vhost.build(s).to_h }
  }
end

Public Instance Methods

to_h() click to toggle source
Calls superclass method
# File lib/kumonos/routes.rb, line 26
def to_h
  h = super
  h[:routes] = routes.flat_map do |r|
    if r.retry_policy.nil?
      [r.to_h]
    # i.e. retry with gRPC request (HTTP POST)
    elsif r.method
      [r.to_h_with_retry]
    else
      [r.to_h_with_retry, r.to_h]
    end
  end
  h
end