Class: RailsGrpc::Boot
- Inherits:
-
Object
- Object
- RailsGrpc::Boot
- Defined in:
- lib/rails_grpc/boot.rb
Constant Summary collapse
- GRPC_DEFAULT_PORT =
"127.0.0.1:5050"
- GRPC_DEFAULT_POOL_SIZE =
1
- RAILS_BOOT_PATH =
"config/environment.rb"
- GRPC_CONFIG_PATH =
"config/grpc.yml"
Instance Attribute Summary collapse
-
#server ⇒ Object
Returns the value of attribute server.
Instance Method Summary collapse
Instance Attribute Details
#server ⇒ Object
Returns the value of attribute server.
3 4 5 |
# File 'lib/rails_grpc/boot.rb', line 3 def server @server end |
Instance Method Details
#exec(environment) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rails_grpc/boot.rb', line 10 def exec(environment) require File.(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 |