class RailsGrpc::Boot
Constants
- GRPC_CONFIG_PATH
- GRPC_DEFAULT_POOL_SIZE
- GRPC_DEFAULT_PORT
- RAILS_BOOT_PATH
Attributes
server[RW]
Public Instance Methods
exec(environment)
click to toggle source
# File lib/rails_grpc/boot.rb, line 10 def exec(environment) require File.expand_path(RAILS_BOOT_PATH) # Load rails require "rails_grpc/general_server" c = config[environment] @server = RailsGrpc::GeneralServer.new( port: c["server"]["port"] || GRPC_DEFAULT_PORT, pool_size: c["server"]["pool_size"] || GRPC_DEFAULT_POOL_SIZE ) @server.set_handlers(c["handlers"].map(&:constantize)) @server.run end
Private Instance Methods
config()
click to toggle source
# File lib/rails_grpc/boot.rb, line 25 def config @_config ||= load_config_file end
load_config_file()
click to toggle source
# File lib/rails_grpc/boot.rb, line 29 def load_config_file if File.exist?(GRPC_CONFIG_PATH) require 'erb' YAML.load(ERB.new(IO.read(GRPC_CONFIG_PATH)).result) else puts "config/grpc.yml file not found." exit 1 end end