<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>{{ .ReverseDNS }}</string>
	<key>ProgramArguments</key>
	<array>
		{{- if .Interpreter }}
		<string>{{ .Interpreter }}</string>
		{{- end }}
		<string>{{ .Exec }}</string>
		{{- range $arg := .Argv }}
		<string>{{ $arg }}</string>
	  {{- end }}
	</array>
	{{- if .Envs }}
	<key>EnvironmentVariables</key>
	<dict>
		{{- range $key, $value := .Envs }}
		<key>{{ $key }}</key>
		<string>{{ $value }}</string>
		{{- end }}
	</dict>
	{{- end }}

	{{if .User -}}
	<key>UserName</key>
	<string>{{ .User }}</string>
	<key>GroupName</key>
	<string>{{ .Group }}</string>
	<key>InitGroups</key>
	<true/>

	{{end -}}
	<key>RunAtLoad</key>
	<true/>
	{{ if .Restart -}}
	<key>KeepAlive</key>
	<true/>
	<!--dict>
		<key>Crashed</key>
		<true/>
		<key>NetworkState</key>
		<true/>
		<key>SuccessfulExit</key>
		<false/>
	</dict-->

	{{ end -}}
	{{ if .Production -}}
	<key>SoftResourceLimits</key>
	<dict>
		<key>NumberOfFiles</key>
		<integer>8192</integer>
	</dict>
	<key>HardResourceLimits</key>
	<dict/>

	{{ end -}}
	{{ if .Workdir -}}
	<key>WorkingDirectory</key>
	<string>{{ .Workdir }}</string>

	{{ end -}}
	<key>StandardErrorPath</key>
	<string>{{ .Logdir }}/{{ .Name }}.log</string>
	<key>StandardOutPath</key>
	<string>{{ .Logdir }}/{{ .Name }}.log</string>
</dict>
</plist>