<?php
// Zabbix GUI configuration file
{% if zabbix_server_history_url is defined %}
global $DB, $HISTORY;
{% else %}
global $DB;
{% endif %}

$DB['TYPE']        = '{{ zabbix_db_type_long | upper()              }}';
$DB['SERVER']      = '{{ zabbix_server_dbhost                               }}';
$DB['PORT']        = '{{ zabbix_server_dbport                               }}';
$DB['DATABASE']    = '{{ zabbix_server_dbname                               }}';
$DB['USER']        = '{{ zabbix_server_dbuser                               }}';
$DB['PASSWORD']    = '{{ zabbix_server_dbpassword                           }}';
$DB['ENCRYPTION']  = {{ 'true' if zabbix_server_dbencryption else 'false'  }};
$DB['VERIFY_HOST'] = {{ 'true' if zabbix_server_dbverifyhost else 'false'  }};

// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '{{ zabbix_server_dbschema }}';
{% if not zabbix_web_connect_ha_backend %}
$ZBX_SERVER      = '{{ zabbix_server_hostname }}';
$ZBX_SERVER_PORT = '{{ zabbix_server_listenport }}';
{% endif %}
$ZBX_SERVER_NAME = '{{ zabbix_server_name }}';

$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;

{% if zabbix_server_history_url is defined %}
$HISTORY['url']		= {{ zabbix_server_history_url }};
$HISTORY['types']	= {{ zabbix_server_history_types | to_json }};
{% endif %}

{% if zabbix_web_doubleprecision is defined and zabbix_web_doubleprecision %}
// Use IEEE754 compatible value range for 64-bit Numeric (float) history values.
// This option is enabled by default for new Zabbix installations.
// For upgraded installations, please read database upgrade notes before enabling this option.
$DB['DOUBLE_IEEE754']   = true;
{% endif %}

{% if zabbix_web_env is defined %}
{% for env,val in zabbix_web_env.items() %}
putenv("{{env}}={{val}}");
{% endfor %}
{% endif %}

{% if zabbix_saml_idp_crt is defined %}
$SSO['IDP_CERT'] = '{{ zabbix_saml_idp_crt }}';
{% endif %}
{% if zabbix_saml_sp_crt is defined %}
$SSO['SP_CERT'] = '{{ zabbix_saml_sp_crt }}';
{% endif %}
{% if zabbix_saml_sp_key is defined %}
$SSO['SP_KEY'] = '{{ zabbix_saml_sp_key }}';
{% endif %}
?>
