[paths]
data = {{ grafana_data_dir | default('/var/lib/grafana') }}
logs = {{ grafana_log_dir | default('/var/log/grafana') }}
plugins = {{ grafana_plugin_dir | default('/var/lib/grafana/plugins') }}
provisioning = {{ grafana_conf_dir | default('/etc/grafana') }}/provisioning

[server]
protocol = http
http_addr = 0.0.0.0
http_port = {{ grafana_port | default(3000) }}
domain = {{ grafana_domain | default('localhost') }}
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
serve_from_sub_path = true

[database]
{% if grafana_pgurl is defined and grafana_pgurl != '' %}
type = postgres
host = {{ grafana_pgurl.split('@')[1].split('/')[0] }}
name = {{ grafana_pgurl.split('/')[-1] }}
user = {{ grafana_pgurl.split('://')[1].split(':')[0] }}
password = {{ grafana_pgurl.split(':')[1].split('@')[0] }}
{% else %}
type = sqlite3
path = grafana.db
{% endif %}

[security]
admin_user = {{ grafana_admin_username | default('admin') }}
admin_password = {{ grafana_admin_password | default('pigsty') }}
disable_gravatar = true
allow_embedding = true
cookie_samesite = disabled

[auth.anonymous]
enabled = true
org_name = {{ grafana_org_name | default('Pigsty') }}
org_role = Viewer

[auth.basic]
enabled = true

[users]
allow_sign_up = false
auto_assign_org = true
auto_assign_org_role = Viewer

[dashboards]
versions_to_keep = 20
min_refresh_interval = 100ms

[panels]
disable_sanitize_html = true

[unified_alerting]
enabled = true
