[buildout]
parts =
  switch-softwaretype

extends =
  ${template-resilient-templates:output}

eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}

[slap-configuration]
recipe = slapos.cookbook:slapconfiguration
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}

[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
RootSoftwareInstance = $${:default}
default = $${:theia}
theia = theia:output
export = export:output
import = import:output
resilient = resilient:output
frozen = instance-frozen:output
pull-backup = template-pull-backup:output

[theia]
recipe = slapos.recipe.template:jinja2
url = ${instance-theia:output}
output = $${buildout:directory}/instance-theia.cfg
extensions = jinja2.ext.do
context =
  jsonkey default_parameter_dict :default-parameters
  key parameter_dict slap-configuration:configuration
  key root_title slap-configuration:root-instance-title
  key partition_root_path buildout:directory
  key ipv6_random slap-configuration:ipv6-random
  key ipv4_random slap-configuration:ipv4-random
  import os os
  import json json
default-parameters =
  {
    "autorun": "running",
    "initial-embedded-instance": null,
    "frontend-name": "Theia Frontend",
    "frontend-sr": "$${:frontend-sr}",
    "frontend-sr-type": "RootSoftwareInstance",
    "frontend-guid": null,
    "additional-frontend-name":"Theia Additional Frontend",
    "additional-frontend-sr": "$${:frontend-sr}",
    "additional-frontend-sr-type": "RootSoftwareInstance",
    "additional-frontend-guid": null,
    "monitor-httpd-port": 8386
  }
frontend-sr = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg

[import]
recipe = slapos.recipe.template:jinja2
url = ${instance-import:output}
output = $${buildout:directory}/instance-import.cfg
context =
  jsonkey default_parameter_dict theia:default-parameters
  key parameter_dict slap-configuration:configuration
  key theia_instance_cfg theia:output
  key pbsready_import_cfg template-pbsready-import:output
  key root_title slap-configuration:root-instance-title

[export]
recipe = slapos.recipe.template:jinja2
url = ${instance-export:output}
output = $${buildout:directory}/instance-export.cfg
context =
  jsonkey default_parameter_dict theia:default-parameters
  key parameter_dict slap-configuration:configuration
  key theia_instance_cfg theia:output
  key pbsready_export_cfg template-pbsready-export:output

[resilient]
recipe = slapos.recipe.template:jinja2
url = ${instance-resilient:output}
output = $${buildout:directory}/instance-resilient.cfg
extensions = jinja2.ext.do
context =
  key buildout buildout:bin-directory
  key develop_eggs_directory buildout:develop-eggs-directory
  key eggs_directory buildout:eggs-directory
  key slapparameter_dict slap-configuration:configuration
  raw monitor_template ${monitor-template:output}
template-parts-destination = ${template-parts:target}
template-replicated-destination = ${template-replicated:target}
import-list = file parts :template-parts-destination
              file replicated :template-replicated-destination
