[buildout]
parts =
  switch-softwaretype

eggs-directory = {{ buildout['eggs-directory'] }}
develop-eggs-directory = {{ buildout['develop-eggs-directory'] }}
offline = true

[profile-common]
nginx_location = {{ nginx_location }}
dash_location = {{ dash_location }}
template_nginx_conf = {{ template_nginx_conf_target }}
template_mime_types = {{ template_mime_types_target }} 
template_launcher = {{ template_launcher_target }}
template_index_html = {{ template_index_html_target }}
template_graceful  = {{ template_graceful_target }}
template_monitor = {{ template_monitor }}

[instance-html5as]
recipe = slapos.recipe.template:jinja2
url = {{ template_instance_html5as_target }}
output = ${buildout:directory}/${:filename}
filename = instance-html5as.cfg
context =
  section buildout buildout
  section parameter_list profile-common
# partition_ipv6 is the random ipv6 allocated to the local partition
  key partition_ipv6 slap-configuration:ipv6-random
# slapparameter_dict: dictionary of all parameters
  key slapparameter_dict slap-configuration:configuration
  jsonkey default_parameter_dict :default-parameters
default-parameters =
  {
    "title": "",
    "download_url": null,
    "port": 8081,
    "monitor-httpd-port": 8197
  }

[instance-replicate]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
url = {{ template_instance_replicate }}
output = ${buildout:directory}/${:filename}
filename = instance-replicate-html5as.cfg
context =
  section buildout buildout
  section parameter_list profile-common
  key slapparameter_dict slap-configuration:configuration
  jsonkey default_parameter_dict :default-parameters
default-parameters =
  {
    "download_url": null,
    "replicate-quantity": 1
  }

[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
RootSoftwareInstance = ${:default}
default = instance-html5as:output
replicate = instance-replicate:output

[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = ${slap-connection:computer-id}
partition = ${slap-connection:partition-id}
url = ${slap-connection:server-url}
key = ${slap-connection:key-file}
cert = ${slap-connection:cert-file}
