lib/tailog.rb in tailog-0.6.0 vs lib/tailog.rb in tailog-0.6.1

- old
+ new

@@ -78,18 +78,23 @@ get '/script' do erb :'script/index' end + ModeMap = { + "bash" => :server_hostname, + "ruby" => :process_uuid + } + post '/script' do result = { server_hostname: Tailog.server_hostname, process_uuid: Tailog.process_uuid } ignore_content = false if params[:broadcast] - instance_id = result[:instance_id] = params[:type] == "bash" ? Tailog.server_hostname : Tailog.process_uuid + instance_id = result[:instance_id] = result[ModeMap[params[:type]]] discovered_instances = params[:discovered_instances] || [] ignore_content = true if discovered_instances.include? instance_id end result[:content] = erb :"script/#{params[:type]}", locals: { script: params[:script] }, layout: false unless ignore_content