Module: LogStash::Outputs::ElasticSearch::SafeURL

Defined in:
lib/logstash/outputs/elasticsearch/safe_url.rb

Constant Summary collapse

PLACEHOLDER =
"~hidden~".freeze

Class Method Summary collapse

Class Method Details

.without_credentials(url) ⇒ Object

Takes a URI object and returns a copy of it with any user or password information replaced with a placeholder ‘~hidden~`.



9
10
11
12
13
14
# File 'lib/logstash/outputs/elasticsearch/safe_url.rb', line 9

def without_credentials(url)
  url.dup.tap do |u|
    u.user = PLACEHOLDER if u.user
    u.password = PLACEHOLDER if u.password
  end
end