[buildout]
extends =
  ../../component/caddy/buildout.cfg
  ../../stack/slapos.cfg
  gowork.cfg

parts =
  gowork
  slapos-cookbook
  instance-profile
  template-caddy
  caddy

[gowork]
install =
  github.com/mholt/caddy
  
[instance-profile]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg.in
md5sum = ae83c35995ce14432ded78ca30cab61b
output =${buildout:directory}/instance.cfg
filename = instance.cfg
mode = 0644

[gopath]
directory = ${buildout:directory}/go.work
src	= ${:directory}/src
bin	= ${:directory}/bin

[template-caddyfile]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/Caddyfile.in
md5sum = 616f9c7cb788e1f1d7cee2093a7dc6ef
output = ${buildout:directory}/Caddyfile.in
mode = 0644

[template-caddy]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-caddy.cfg.in
md5sum = 045022e5698badca5dbdd6b95518f8e1
output = ${buildout:directory}/instance-caddy.cfg.in
mode = 0644

[template-public-html]
recipe = slapos.recipe.template
url =  ${:_profile_base_location_}/index.html
md5sum = b5794ac8b10ed90173ad566e6e324b35
output =  ${buildout:directory}/index.html
mode = 0644

[caddy]
recipe  = slapos.recipe.cmmi
path    = ${caddy-repository:location}
go      = ${gowork:golang}/bin/go
configure-command = :
make-targets =
make-binary = cd ${:path}/caddy && ${:go} install -v
environment =
  PATH=${pkgconfig:location}/bin:${gowork:golang}/bin:${buildout:bin-directory}:%(PATH)s
  GOPATH=${gopath:directory}
output =  ${gopath:bin}/caddy