summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--etc/config/config.dev.yaml3
-rw-r--r--python/constants.py.in3
-rw-r--r--python/knot_resolver/constants.py5
-rw-r--r--python/knot_resolver/datamodel/cache_schema.py3
-rw-r--r--python/knot_resolver/datamodel/config_schema.py2
-rw-r--r--python/meson.build2
6 files changed, 8 insertions, 10 deletions
diff --git a/etc/config/config.dev.yaml b/etc/config/config.dev.yaml
index 1ceddfb3..6705069e 100644
--- a/etc/config/config.dev.yaml
+++ b/etc/config/config.dev.yaml
@@ -1,9 +1,6 @@
-rundir: ./runtime
workers: 1
management:
interface: 127.0.0.1@5000
-cache:
- storage: ./cache
logging:
level: notice
groups:
diff --git a/python/constants.py.in b/python/constants.py.in
index 39de89a0..3f2eb734 100644
--- a/python/constants.py.in
+++ b/python/constants.py.in
@@ -5,9 +5,10 @@ USER = "@user@"
GROUP = "@group@"
# dirs paths
-RUN_DIR = Path("@run_dir@")
+RUN_DIR = Path("@prefix@@run_dir@")
ETC_DIR = Path("@etc_dir@")
SBIN_DIR = Path("@sbin_dir@")
+CACHE_DIR = Path("@cache_dir@")
# files paths
CONFIG_FILE = ETC_DIR / "config.yaml"
diff --git a/python/knot_resolver/constants.py b/python/knot_resolver/constants.py
index fb45c26b..5288b519 100644
--- a/python/knot_resolver/constants.py
+++ b/python/knot_resolver/constants.py
@@ -8,15 +8,12 @@ GROUP = "knot-resolver"
RUN_DIR = Path("/run/knot-resolver")
ETC_DIR = Path("/etc/knot-resolver")
SBIN_DIR = Path("/usr/bin")
+CACHE_DIR = Path("/var/cache/knot-resolver")
# files paths
CONFIG_FILE = ETC_DIR / "config.yaml"
API_SOCK_FILE = RUN_DIR / "kres-api.sock"
-# environmental variables
-CONFIG_FILE_ENV_VAR = "KRES_CONFIG_FILE"
-API_SOCK_FILE_ENV_VAR = "KRES_API_SOCK_FILE"
-
# executables paths
KRESD_EXECUTABLE = SBIN_DIR / "kresd"
KRES_CACHE_GC_EXECUTABLE = SBIN_DIR / "kres-cache-gc"
diff --git a/python/knot_resolver/datamodel/cache_schema.py b/python/knot_resolver/datamodel/cache_schema.py
index 3f7d1dc2..d40ee2a0 100644
--- a/python/knot_resolver/datamodel/cache_schema.py
+++ b/python/knot_resolver/datamodel/cache_schema.py
@@ -1,5 +1,6 @@
from typing import List, Literal, Optional, Union
+from knot_resolver.constants import CACHE_DIR
from knot_resolver.datamodel.templates import template_from_str
from knot_resolver.datamodel.types import (
DNSRecordTypeEnum,
@@ -123,7 +124,7 @@ class CacheSchema(ConfigSchema):
prefetch: These options help keep the cache hot by prefetching expiring records or learning usage patterns and repetitive queries.
"""
- storage: WritableDir = lazy_default(WritableDir, "/var/cache/knot-resolver")
+ storage: WritableDir = lazy_default(WritableDir, str(CACHE_DIR))
size_max: SizeUnit = SizeUnit("100M")
garbage_collector: Union[GarbageCollectorSchema, Literal[False]] = GarbageCollectorSchema()
ttl_min: TimeUnit = TimeUnit("5s")
diff --git a/python/knot_resolver/datamodel/config_schema.py b/python/knot_resolver/datamodel/config_schema.py
index 4e3d8b3d..ddadd7fb 100644
--- a/python/knot_resolver/datamodel/config_schema.py
+++ b/python/knot_resolver/datamodel/config_schema.py
@@ -239,7 +239,7 @@ def get_rundir_without_validation(data: Dict[str, Any]) -> WritableDir:
Used for initial manager startup.
"""
- return WritableDir(data["rundir"] if "rundir" in data else RUN_DIR, object_path="/rundir")
+ return WritableDir(data["rundir"] if "rundir" in data else str(RUN_DIR), object_path="/rundir")
def kres_config_json_schema() -> Dict[str, Any]:
diff --git a/python/meson.build b/python/meson.build
index f6539e51..a0ea0c06 100644
--- a/python/meson.build
+++ b/python/meson.build
@@ -5,9 +5,11 @@ constants_config = configuration_data()
constants_config.set('version', meson.project_version())
constants_config.set('user', user)
constants_config.set('group', group)
+constants_config.set('prefix', prefix)
constants_config.set('run_dir', run_dir)
constants_config.set('etc_dir', etc_dir)
constants_config.set('sbin_dir', sbin_dir)
+constants_config.set('cache_dir', systemd_cache_dir)
configure_file(
input: 'constants.py.in',