diff --git a/README.md b/README.md index 0b8e297..4b1dcee 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ With following configuration, you can access http://localhost:24231/metrics on a More configuration parameters: -- `bind`: binding interface (default: '0.0.0.0') +- `bind`: binding interface (default: '127.0.0.1') - `port`: listen port (default: 24231) - `metrics_path`: metrics HTTP endpoint (default: /metrics) - `aggregated_metrics_path`: metrics HTTP endpoint (default: /aggregated_metrics) diff --git a/lib/fluent/plugin/in_prometheus.rb b/lib/fluent/plugin/in_prometheus.rb index 862e298..22b5d71 100644 --- a/lib/fluent/plugin/in_prometheus.rb +++ b/lib/fluent/plugin/in_prometheus.rb @@ -11,7 +11,7 @@ class PrometheusInput < Fluent::Plugin::Input helpers :thread, :http_server - config_param :bind, :string, default: '0.0.0.0' + config_param :bind, :string, default: '127.0.0.1' config_param :port, :integer, default: 24231 config_param :metrics_path, :string, default: '/metrics' config_param :aggregated_metrics_path, :string, default: '/aggregated_metrics' diff --git a/spec/fluent/plugin/in_prometheus_spec.rb b/spec/fluent/plugin/in_prometheus_spec.rb index 8bff55f..a343e58 100644 --- a/spec/fluent/plugin/in_prometheus_spec.rb +++ b/spec/fluent/plugin/in_prometheus_spec.rb @@ -22,9 +22,16 @@ describe '#configure' do describe 'bind' do let(:config) { CONFIG + %[ - bind 127.0.0.1 + bind ::1 ] } it 'should be configurable' do + expect(driver.instance.bind).to eq('::1') + end + end + + describe 'default bind' do + let(:config) { CONFIG } + it 'should be accessible from 127.0.0.1 by default' do expect(driver.instance.bind).to eq('127.0.0.1') end end