Skip to content

Commit 06e25cf

Browse files
authored
Merge pull request #759 from code0-tech/add-configurable-host
Add configurable host
2 parents c2dbef0 + bebce52 commit 06e25cf

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

config/puma.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,15 @@
2323
# terminating a worker in development environments.
2424
worker_timeout 3600 if ENV.fetch('RAILS_ENV', 'development') == 'development'
2525

26-
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
27-
port Sagittarius::Configuration.config[:rails][:web][:port]
26+
# Specify either a `bind` or `port` to listen on.
27+
bind_uri = Sagittarius::Configuration.config[:rails][:web][:bind]
28+
port_number = Sagittarius::Configuration.config[:rails][:web][:port]
29+
30+
if bind_uri
31+
bind bind_uri
32+
else
33+
port port_number
34+
end
2835

2936
# Specifies the `environment` that Puma will run in.
3037
environment ENV.fetch('RAILS_ENV', 'development')

config/sagittarius.example.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ rails:
1010
password: changeme
1111
web:
1212
port: 3000
13+
bind: # For example: tcp://0.0.0.0:3000
1314
force_ssl:
1415
grpc:
1516
host: '0.0.0.0:50051'

lib/sagittarius/configuration.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def self.defaults
2424
web: {
2525
port: 3000,
2626
force_ssl: nil,
27+
bind: nil,
2728
},
2829
grpc: {
2930
host: '0.0.0.0:50051',

0 commit comments

Comments
 (0)