Skip to content

Commit

Permalink
Add hostname and worker_id to code to suppress warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
repeatedly committed Jan 16, 2018
1 parent ebd5797 commit e55b227
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/fluent/config/literal_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,11 @@ def eval_embedded_code(code)
if @eval_context.nil?
parse_error! "embedded code is not allowed in this file"
end
hostname = Socket.gethostname
worker_id = ENV['SERVERENGINE_WORKER_ID'] || ''
# Add hostname and worker_id to code for preventing unused warnings
code = <<EOM + code
hostname = Socket.gethostname
worker_id = ENV['SERVERENGINE_WORKER_ID'] || ''
EOM
@eval_context.instance_eval(code)
end

Expand Down

0 comments on commit e55b227

Please sign in to comment.