<%
   prefix = "#{@authbind ? '/usr/bin/authbind --deep ' : ''}"
   asadmin = "#{node['glassfish']['base_dir']}/versions/current/bin/asadmin"
   domaindir = "--domaindir #{node['glassfish']['domains_dir']}"

   environment = ""
   @new_resource.env_variables.sort.each do |key, value| 
     environment+= "#{key}=#{value} "
   end
%>
[Unit]
Description = GlassFish Server for <%= @new_resource.domain_name %>
After = syslog.target network.target remote-fs.target
 
[Service]
User=<%= node['glassfish']['user'] %>
ExecStart = <%= "#{prefix} #{@start_domain_command}" %>
ExecStop = <%= "#{prefix} #{@stop_domain_command}" %>
ExecReload = <%= "#{prefix} #{@restart_domain_command}" %>
Type = forking
<%- if @new_resource.env_variables %>
Environment = "<%= environment.rstrip %>"
<% end -%>
 
[Install]
WantedBy = multi-user.target

<%
   prefix = "#{@authbind ? '/usr/bin/authbind --deep ' : ''}"
   asadmin = "#{node['glassfish']['base_dir']}/versions/current/bin/asadmin"
   domaindir = "--domaindir #{node['glassfish']['domains_dir']}"
%>
[Unit]
Description = GlassFish Server for <%= @new_resource.domain_name %>
After = syslog.target network.target remote-fs.target
 
[Service]
User=<%= node['glassfish']['user'] %>
ExecStart = <%= "#{prefix} #{@start_domain_command}" %>
ExecStop = <%= "#{prefix} #{@stop_domain_command}" %>
ExecReload = <%= "#{prefix} #{@restart_domain_command}" %>
Type = forking
<%- if @new_resource.env_variables
  @new_resource.env_variables.sort.each do |key, value| %>
Environment="<%= key %>=<%= value %>"
<% end -%>
<% end -%>
 
[Install]
WantedBy = multi-user.target

Fix to systemd environment variables
Fix to systemd environment variables
