Skip to content

Commit f394b8b

Browse files
committed
Make gRPC server host configurable in the configuration
1 parent d7b5663 commit f394b8b

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

config/sagittarius.example.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ rails:
44
web:
55
port: 3000
66
force_ssl:
7+
grpc:
8+
host: '0.0.0.0:50051'
79
db:
810
host: localhost
911
port: 5433

lib/sagittarius/configuration.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ def self.defaults
2525
port: 3000,
2626
force_ssl: nil,
2727
},
28+
grpc: {
29+
host: '0.0.0.0:50051',
30+
},
2831
log_level: 'info',
2932
db: {
3033
host: 'localhost',

lib/sagittarius/grpc/launcher.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Grpc
55
class Launcher
66
include Code0::ZeroTrack::Loggable
77

8-
HOST = '0.0.0.0:50051'
8+
HOST = Sagittarius::Configuration.config[:rails][:grpc][:host]
99

1010
def create_server
1111
@server = GRPC::RpcServer.new(interceptors: [
@@ -15,7 +15,6 @@ def create_server
1515
].reverse) # grpc handles interceptors in opposite order. Reversing so we can list them in top-to-bottom order
1616
logger.info('GRPC server created')
1717

18-
# TODO: make this configurable
1918
@server.add_http2_port(HOST, :this_port_is_insecure)
2019

2120
logger.info('Loading application')

0 commit comments

Comments
 (0)