[paths]

[server]
protocol = http
http_addr = 0.0.0.0
http_port = {{ grafana_port }}
{% if grafana_root_url is defined %}
root_url = {{ grafana_root_url }}
{% endif %}

[database]
type = {{ grafana_db_type }}
{% if grafana_db_type == 'sqlite3' %}
path = grafana.db
{% else %}
host = {{ grafana_db_server }}{% if grafana_db_port is defined and not grafana_db_server is match ('^/') %}:{{ grafana_db_port }}{% endif %}

name = {{ grafana_db_name }}
user = {{ grafana_db_user }}
password = {{ grafana_db_pass }}
{% endif %}

[session]

[dataproxy]

[analytics]
reporting_enabled = {{ grafana_reporting | ternary('true', 'false') }}
check_for_updates = {{ grafana_check_for_updates | ternary('true', 'false') }}

[security]
secret_key = {{ grafana_secret_key }}

[snapshots]

[users]
allow_sign_up = {{ grafana_allow_sign_up | ternary('true','false') }}

[auth]

[auth.anonymous]
{% if grafana_auth.anonymous is defined and grafana_auth.anonymous.enabled | default(True) %}
enabled = true
{% if grafana_auth.anonymous.org_name is defined %}
org_name = {{ grafana_auth.anonymous.org_name }}
{% endif %}
{% if grafana_auth.anonymous.org_role is defined %}
org_role = {{ grafana_auth.anonymous.org_role }}
{% endif %}
{% endif %}

[auth.proxy]
{% if grafana_auth.proxy is defined and grafana_auth.proxy.enabled | default(True) %}
enabled = true
header_name = {{ grafana_auth.proxy.header_name | default('User-Name') }}
header_property = username
auto_sign_up = true
{% if grafana_auth.proxy.whitelist is defined %}
whitelist = {{ grafana_auth.proxy.whitelist | join(',') }}
{% endif %}
{% endif %}

[auth.basic]

[auth.ldap]
{% if grafana_auth.ldap is defined and grafana_auth.ldap.enabled | default(True) %}
enabled = true
config_file = /etc/grafana/ldap.toml
{% endif %}

[emails]

[log]
mode = console
level = {{ grafana_log_level }}
