[buildout]
extends =
  {{ kvm_template }}
  {{ pbsready_export_template }}

parts +=
  cron-entry-backup

  certificate-authority
  certificate-authority-service
  publish-connection-information
  kvm-vnc-promise
  kvm-disk-image-corruption-promise
  websockify-sighandler
  websockify-sighandler-service
  novnc-promise
  cron
  cron-service
  frontend-promise
# monitor parts
  monitor-base

# Create the exporter executable, which is a simple shell script
[exporter]
recipe = slapos.recipe.template:jinja2
template = {{ template_kvm_export }}
rendered = ${directory:bin}/${slap-parameter:namebase}-exporter
# Resilient stack wants a "wrapper" parameter
wrapper = ${:rendered}
mode = 0700
context =
    section directory directory
    section buildout buildout
    key socket_path kvm-instance:socket-path
    raw gzip_binary {{ gzip_binary }}

# Extends publish section with resilient parameters
[publish-connection-information]
<= resilient-publish-connection-parameter
monitor-base-url = ${monitor-publish:monitor-base-url}
monitor-setup-url = ${monitor-publish:monitor-setup-url}

[monitor-instance-parameter]
monitor-httpd-port = 8026
monitor-title = {{ slapparameter_dict.get('name', 'KVM Standalone') }}
cors-domains = {{ slapparameter_dict.get('monitor-cors-domains', 'monitor.app.officejs.com') }}
{% if slapparameter_dict.get('monitor-username', '') -%}
username = {{ slapparameter_dict['monitor-username'] }}
{% endif -%}
{% if slapparameter_dict.get('monitor-password', '') -%}
password = {{ slapparameter_dict['monitor-password'] }}
{% endif -%}

