From 25ae3c64dcd99006916b2b44b95eedd648b798c0 Mon Sep 17 00:00:00 2001 From: mbonino <42541934+mbonino@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:50:21 +0200 Subject: [PATCH] Load ``default_tag_expiration`` from ``yeti.conf`` (#1147) Co-authored-by: Thomas Chopitea --- core/schemas/tag.py | 9 ++++++++- yeti.conf.sample | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/core/schemas/tag.py b/core/schemas/tag.py index 5fd4273dc..e627e68dc 100644 --- a/core/schemas/tag.py +++ b/core/schemas/tag.py @@ -6,10 +6,17 @@ from pydantic import Field from core import database_arango +from core.config.config import yeti_config from core.helpers import now from core.schemas.model import YetiModel -DEFAULT_EXPIRATION = datetime.timedelta(days=30) # Completely arbitrary +DEFAULT_EXPIRATION = datetime.timedelta( + days=yeti_config.get( + "tag", + "default_tag_expiration", + default=90, # Completely arbitrary + ) +) MAX_TAG_LENGTH = 50 MAX_TAGS_REQUEST = 50 diff --git a/yeti.conf.sample b/yeti.conf.sample index b7127936d..46580094e 100644 --- a/yeti.conf.sample +++ b/yeti.conf.sample @@ -47,10 +47,10 @@ enabled = True ## ## Use these settings to configure Yeti tags. ## If you specify default_tag_expiration = 7776000, then the tag will expire for 90 days. -## Value must be in seconds (7776000 seconds is 90 days). +## Value must be in days. ## -# default_tag_expiration = 7776000 +# default_tag_expiration = 90 [arangodb]