Skip to content

Commit

Permalink
feat(smtp_server): allow bind address to be configured
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcooke committed Jul 27, 2021
1 parent e0ba05a commit 4a410c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/postal.defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ workers:

smtp_server:
port: 25
bind_address: '::'
tls_enabled: false
tls_certificate_path: # Defaults to config/smtp.cert
tls_private_key_path: # Defaults to config/smtp.key
Expand Down
4 changes: 2 additions & 2 deletions lib/postal/smtp_server/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def listen
if ENV['SERVER_FD']
@server = TCPServer.for_fd(ENV['SERVER_FD'].to_i)
else
@server = TCPServer.open('::', Postal.config.smtp_server.port)
@server = TCPServer.open(Postal.config.smtp_server.bind_address, Postal.config.smtp_server.port)
end
@server.autoclose = false
@server.close_on_exec = false
Expand All @@ -62,7 +62,7 @@ def listen
@server.setsockopt(Socket::SOL_TCP, Socket::TCP_KEEPCNT, 5)
end
ENV['SERVER_FD'] = @server.to_i.to_s
logger.info "Listening on port #{Postal.config.smtp_server.port}"
logger.info "Listening on #{Postal.config.smtp_server.bind_address}:#{Postal.config.smtp_server.port}"
end

def unlisten
Expand Down

0 comments on commit 4a410c8

Please sign in to comment.