Skip to content

Instantly share code, notes, and snippets.

@ArthurClune
Created April 7, 2011 08:24
Show Gist options
  • Save ArthurClune/907330 to your computer and use it in GitHub Desktop.
Save ArthurClune/907330 to your computer and use it in GitHub Desktop.
sample ldirectord.erb
virtual=<%= vip %>:<%= port %>
<% if weights.empty? then -%><% real_servers.each do |real_server| -%>
real=<%= real_server %>:<%= port %> gate
<% end -%><% else -%><% real_servers.zip(weights).each do |real_server, weight| -%>
real=<%= real_server %>:<%= port %> gate <%= weight %>
<% end -%><% end -%>
<% if not checktype.empty? then -%>
checktype=<%= checktype -%>
<% end -%>
<% if not service.empty? then -%>
service=<%= service %>
<% end -%>
<% if not checkcommand.empty? then -%>
checkcommand=<%= checkcommand %>
<% end -%>
protocol=<%= protocol %>
scheduler=<%= scheduler %>
persistent=<%= persistent %>
virtual=192.168.1.1:53
real=192.168.1.2:53 gate
real=192.168.1.3:53 gate
protocol=udp
scheduler=rr
persistent=300
virtual=<%= vip %>:<%= port %>
<%=
out=""
if weights.empty? then
real_servers.each do |real_server|
out += " real=" + real_server + " port:" + port + " gate\n"
end
else
real_servers.zip(weights).each do |real_server, weight|
out += " real= " + real_server + " port:" + port + " gate " + weight + "\n"
end
end
if not checktype.empty? then
out += " checktype=" + checktype + "\n"
end
if not service.empty? then
out += " service=" + service + "\n"
end
if not checkcommand.empty? then
out += " checkcommand=" + checkcommand + "\n"
end
out += " protocol=" + protocol + "\n"
out += " scheduler=" + scheduler + "\n"
out += " persistent=" + persistent
out
-%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment