Class: Gruf::Server
Overview
Represents a gRPC server. Automatically loads and augments gRPC handlers and services based on configuration values.
Instance Attribute Summary collapse
-
#services ⇒ Object
Returns the value of attribute services.
Instance Method Summary collapse
-
#initialize(services: []) ⇒ Server
constructor
A new instance of Server.
-
#start! ⇒ Object
Start the gRPC server.
Methods included from Loggable
Constructor Details
#initialize(services: []) ⇒ Server
Returns a new instance of Server.
27 28 29 30 |
# File 'lib/gruf/server.rb', line 27 def initialize(services: []) setup! load_services(services) end |
Instance Attribute Details
#services ⇒ Object
Returns the value of attribute services.
25 26 27 |
# File 'lib/gruf/server.rb', line 25 def services @services end |
Instance Method Details
#start! ⇒ Object
Start the gRPC server
:nocov:
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/gruf/server.rb', line 36 def start! logger.info { 'Booting gRPC Server...' } server = GRPC::RpcServer.new server.add_http2_port Gruf.server_binding_url, ssl_credentials services.each do |s| server.handle(s) end server.run_till_terminated logger.info { 'Shutting down gRPC server...' } end |