From ac64ecd3e22bfe482427269c5e982de73ccd319a Mon Sep 17 00:00:00 2001 From: Matthew Richardson Date: Fri, 6 Mar 2015 10:27:26 +0000 Subject: [PATCH] Rename 'host' to 'bind_address'. Add 'bind_address' to example config --- etc/flapjack_config.toml.example | 2 ++ lib/flapjack/pikelet.rb | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/etc/flapjack_config.toml.example b/etc/flapjack_config.toml.example index 52d27e34a..69f308e6b 100644 --- a/etc/flapjack_config.toml.example +++ b/etc/flapjack_config.toml.example @@ -166,6 +166,7 @@ daemonize = true # Browsable web interface [gateways.web] enabled = true + #bind_address = "127.0.0.1" port = 3080 timeout = 300 # Seconds between auto_refresh of entities/checks pages. Set to 0 to disable @@ -181,6 +182,7 @@ daemonize = true # HTTP API server [gateways.jsonapi] enabled = true + #bind_address = "127.0.0.1" port = 3081 timeout = 300 access_log = "/var/log/flapjack/jsonapi_access.log" diff --git a/lib/flapjack/pikelet.rb b/lib/flapjack/pikelet.rb index 1e1c07e9e..089b2097d 100755 --- a/lib/flapjack/pikelet.rb +++ b/lib/flapjack/pikelet.rb @@ -163,18 +163,18 @@ def start @pikelet_class.instance_variable_set('@config', @config) if @config - host = @config['host'] + bind_address = @config['bind_address'] port = @config['port'] port = port.nil? ? nil : port.to_i timeout = @config['timeout'] timeout = timeout.nil? ? 300 : timeout.to_i end - host = '127.0.0.1' if (host.nil?) + bind_address = '127.0.0.1' if (bind_address.nil?) port = 3001 if (port.nil? || port <= 0 || port > 65535) super do @pikelet_class.start if @pikelet_class.respond_to?(:start) - @server = ::WEBrick::HTTPServer.new(:Port => port, :BindAddress => host, + @server = ::WEBrick::HTTPServer.new(:Port => port, :BindAddress => bind_address, :AccessLog => [], :Logger => WEBrick::Log::new("/dev/null", 7)) @server.mount "/", Rack::Handler::WEBrick, @pikelet_class yield @server if block_given?