From bac0983e9c01b22e45d1da966270283d5f136d12 Mon Sep 17 00:00:00 2001 From: Jakob Schlyter Date: Sun, 22 Dec 2024 12:23:25 +0100 Subject: [PATCH] ttl --- nodeman/settings.py | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/nodeman/settings.py b/nodeman/settings.py index 270f51a..2b95501 100644 --- a/nodeman/settings.py +++ b/nodeman/settings.py @@ -2,11 +2,23 @@ from typing import Annotated, Self from argon2 import PasswordHasher -from pydantic import AnyHttpUrl, BaseModel, Field, FilePath, StringConstraints, UrlConstraints, model_validator -from pydantic_core import Url -from pydantic_settings import BaseSettings, PydanticBaseSettingsSource, SettingsConfigDict, TomlConfigSettingsSource - from dnstapir.opentelemetry import OtlpSettings +from pydantic import ( + AnyHttpUrl, + BaseModel, + Field, + FilePath, + StringConstraints, + UrlConstraints, + model_validator, +) +from pydantic_core import Url +from pydantic_settings import ( + BaseSettings, + PydanticBaseSettingsSource, + SettingsConfigDict, + TomlConfigSettingsSource, +) MqttUrl = Annotated[ Url, @@ -45,7 +57,12 @@ class NodesSettings(BaseModel): trusted_jwks: FilePath | None = Field(default=None) mqtt_broker: MqttUrl = Field(default="mqtt://localhost") mqtt_topics: dict[str, str] = Field(default={}) - configuration_ttl: int = Field(default=300) + configuration_ttl: int = Field( + default=300, + gt=0, + le=86400, + description="Configuration cache TTL in seconds", + ) class User(BaseModel):