[buildout]
parts = switch-softwaretype

# std stuff for slapos instance
eggs-directory = {{ buildout_egg_directory }}
develop-eggs-directory = {{ buildout_develop_directory }}
offline = true


[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
default  = dynamic-template-jscrawler:output
RootSoftwareInstance = ${:default}

[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}

[jinja2-template-base]
recipe = slapos.recipe.template:jinja2
output = ${buildout:directory}/${:filename}
extensions = jinja2.ext.do
extra-context =
context =
  key develop_eggs_directory buildout:develop-eggs-directory
  key buildout_directory buildout:directory
  key eggs_directory buildout:eggs-directory
  key ipv4 slap-configuration:ipv4
  key ipv6 slap-configuration:ipv6
  key global_ipv4_prefix network-information:global-ipv4-network
  key slapparameter_dict slap-configuration:configuration
  key computer_id slap-configuration:computer
  raw bash_executable_location {{ bash_location }}/bin/dash
  raw template_monitor {{ template_monitor_cfg }}
  raw logrotate_cfg {{ logrotate_cfg }}
  ${:extra-context}


[dynamic-template-jscrawler-parameters]
openssl = {{ openssl_location }}/bin/openssl
jscrawler-location = {{ jscrawler_location }}/crawler.js
nodejs-location = {{ nodejs_location }}/bin/node
template-jscrawler = {{ template_jscrawler_builder }}

[dynamic-template-jscrawler]
<= jinja2-template-base
url = {{ template_jscrawler }}
filename = instance-jscrawler.cfg
extra-context =
  section parameter_dict dynamic-template-jscrawler-parameters
