service: simplify Environment= creation

Co-authored-by: Bo Anderson <mail@boanderson.me>
This commit is contained in:
Sean Molenaar 2021-05-25 11:46:18 +02:00 committed by Sean Molenaar
parent ef9c49c5b2
commit 4f013526cf
No known key found for this signature in database
GPG Key ID: 6BF5D8DF0D34FAAE

View File

@ -226,10 +226,7 @@ module Homebrew
options << "StandardInput=file:#{@input_path}" if @input_path.present?
options << "StandardOutput=append:#{@log_path}" if @log_path.present?
options << "StandardError=append:#{@error_log_path}" if @error_log_path.present?
if @environment_variables.present?
list = @environment_variables.map { |k, v| "#{k}=#{v}" }
.each { |value| options << "Environment=\"#{value}\"" }
end
options += @environment_variables.map { |k, v| "Environment=\"#{k}=#{v}\"" } if @environment_variables.present?
unit + options.join("\n")
end