[buildout]
extends =
  ../../component/golang/buildout.cfg
  ../../stack/slapos.cfg
  ../../component/dash/buildout.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 = 403f86b667f7a5d397993735bcd162ab
output =${buildout:directory}/instance.cfg
filename = instance.cfg
mode = 0644

[template-caddyfile]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/Caddyfile.in
md5sum = 88c4c33e374ea3f61cdd36b2816d24ba
filename = Caddyfile.in
location = ${buildout:parts-directory}/${:_buildout_section_name_}
mode = 0644

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

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

[template-caddy-service]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/template-caddy-service.sh.in
md5sum = 5467fac7b95acde681e613ae98ce990d
output = ${buildout:directory}/template-caddy-service.sh.in
mode = 0644

[caddy]
recipe  = slapos.recipe.cmmi
path    = ${go_github.com_mholt_caddy: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=${gowork:directory}
output =  ${gowork:bin}/caddy