migrate config reputation_expiry as well

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
Marc 'risson' Schmitt 2023-11-21 18:22:07 +01:00
parent b8fcb5e60d
commit 3ec3cd5113
No known key found for this signature in database
GPG key ID: 9C3FA22FABF1AA8D
3 changed files with 3 additions and 4 deletions

View file

@ -99,9 +99,6 @@ ldap:
tls:
ciphers: null
reputation:
expiry: 86400
cookie_domain: null
disable_update_check: false
disable_startup_analytics: false

View file

@ -16,6 +16,7 @@ from authentik.lib.models import SerializerModel
from authentik.lib.utils.http import get_client_ip
from authentik.policies.models import Policy
from authentik.policies.types import PolicyRequest, PolicyResult
from authentik.tenants.utils import get_current_tenant
LOGGER = get_logger()
CACHE_KEY_PREFIX = "goauthentik.io/policies/reputation/scores/"
@ -23,7 +24,7 @@ CACHE_KEY_PREFIX = "goauthentik.io/policies/reputation/scores/"
def reputation_expiry():
"""Reputation expiry"""
return now() + timedelta(seconds=CONFIG.get_int("reputation.expiry"))
return now() + timedelta(seconds=get_current_tenant().reputation_expiry)
class ReputationPolicy(Policy):

View file

@ -24,6 +24,7 @@ def create_default_tenant(apps, schema_editor):
gdpr_compliance=CONFIG.get_bool("gdpr_compliance", True),
impersonation=CONFIG.get_bool("impersonation", True),
footer_links=CONFIG.get("footer_links", default=[]),
reputation_expiry=CONFIG.get_int("reputation_expiry", default=86400),
)
Domain = apps.get_model("authentik_tenants", "Domain")