File: policy-loader.lua.j2

package info (click to toggle)
knot-resolver 6.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 16,392 kB
  • sloc: javascript: 42,732; ansic: 40,312; python: 12,616; cpp: 2,121; sh: 1,997; xml: 193; makefile: 181
file content (66 lines) | stat: -rw-r--r-- 1,541 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{% if not cfg.lua.policy_script_only %}

-- FFI library
ffi = require('ffi')
local C = ffi.C

-- logging.level
{% if cfg.logging.groups and "policy-loader" in cfg.logging.groups %}
log_level('debug')
{% else %}
log_level('{{ cfg.logging.level }}')
{% endif %}

{% if cfg.logging.target -%}
-- logging.target
log_target('{{ cfg.logging.target }}')
{%- endif %}

{% if cfg.logging.groups %}
-- logging.groups
log_groups({
{% for g in cfg.logging.groups %}
{% if g not in [
    "manager", "supervisord", "policy-loader", "kresd", "cache-gc",
    "files", "metrics", "server",
] %}
    '{{ g }}',
{% endif %}
{% endfor %}
})
{% endif %}

-- Config required for the cache opening
cache.open({{ cfg.cache.size_max.bytes() }}, 'lmdb://{{ cfg.cache.storage }}')

-- VIEWS section ------------------------------------
{% include "views.lua.j2" %}

-- LOCAL-DATA section -------------------------------
{% include "local_data.lua.j2" %}

-- FORWARD section ----------------------------------
{% include "forward.lua.j2" %}

-- DEFER section ------------------------------------
-- Force-disable defer to avoid the default defer config.
{% set disable_defer = true %}
{% include "defer.lua.j2" %}

{% endif %}

-- LUA section --------------------------------------
-- Custom Lua code cannot be validated

{% if cfg.lua.policy_script_file %}
{% import cfg.lua.policy_script_file as policy_script_file %}
{{ policy_script_file }}
{% endif %}

{% if cfg.lua.policy_script %}
{{ cfg.lua.policy_script }}
{% endif %}


-- exit policy-loader properly
quit()