File tree Expand file tree Collapse file tree
logstash-core/lib/logstash/util Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,10 +76,12 @@ def replace_placeholders(value)
7676 raise LogStash ::ConfigurationError , "Cannot evaluate `#{ placeholder } `. Replacement variable `#{ name } ` is not defined in a Logstash secret store " +
7777 "or as an Environment entry and there is no default value given."
7878 end
79- # if ENV may carry array string, remove literal brackets and make array
80- # use YAML for backward compatibility to cover the cases with escaped chars (ex "[\"*\"]" => ["*"])
81- # YAML.load('*') fails but it is a valid use case
82- return replacement . is_a? ( String ) && replacement != '*' ? YAML . load ( replacement ) : replacement . to_s
79+ # ENV may carry single quote or escaped double quote or single/double quoted entries in array string
80+ if replacement . is_a? ( String )
81+ refined = replacement . gsub ( /[\\ "\\ ']/ , '' )
82+ return refined . start_with? ( '[' ) && refined . end_with? ( ']' ) ? refined [ 1 ..-2 ] . split ( ',' ) . map ( &:strip ) : refined
83+ end
84+ replacement . to_s
8385 end
8486 end # def replace_placeholders
8587
You can’t perform that action at this time.
0 commit comments