# runtime
RunAsDaemon 1
<%  if (v=scope.lookupvar('tor::daemon::data_dir')) != '/var/lib/tor' -%>
DataDirectory <%= v %>
<% end -%>

# log
<% if (rules=scope.lookupvar('tor::daemon::log_rules')).empty? -%>
Log notice syslog
<%  else -%>
<%   rules.each do |log_rule| -%>
Log <%= log_rule %>
<%    end -%>
<%  end -%>
<%- if @safe_logging != 1 then -%>
SafeLogging <%= @safe_logging %>
<%-   end -%>

<%  if (v=scope.lookupvar('tor::daemon::automap_hosts_on_resolve')) != '0' -%>
AutomapHostsOnResolve <%= v %>
<%  end -%>
<%  if (v=scope.lookupvar('tor::daemon::use_bridges')) != '0' -%>
UseBridges <%= v %>
<%- end -%>

# runtime
RunAsDaemon 1
<%  if (v=scope.lookupvar('tor::daemon::data_dir')) != '/var/lib/tor' -%>
DataDirectory <%= v %>
<% end -%>

# log
<% if (rules=scope.lookupvar('tor::daemon::log_rules')).empty? -%>
Log notice syslog
<%  else -%>
<%   rules.each do |log_rule| -%>
Log <%= log_rule %>
<%    end -%>
<%  end -%>
<%- if (v=scope.lookupvar('tor::daemon::safe_logging')) != '1' then -%>
SafeLogging <%= v %>
<%-   end -%>

<%  if (v=scope.lookupvar('tor::daemon::automap_hosts_on_resolve')) != '0' -%>
AutomapHostsOnResolve <%= v %>
<%  end -%>
<%  if (v=scope.lookupvar('tor::daemon::use_bridges')) != '0' -%>
UseBridges <%= v %>
<%- end -%>

Update template to really honor tor::daemon's safe_logging parameter.
Update template to really honor tor::daemon's safe_logging parameter.

Without this change, using tor::daemon with the default safe_logging
parameter results in a "SafeLogging 1" line being added to torrc,
which is obviously not the intent of this piece of code.

Also, this change makes parameters lookup consistent with how it's done
everywhere else in this ERB template.
