avatar: move timeout to config

pull/2/head
radex 2023-10-14 15:59:55 +02:00
parent fede3f68e5
commit a6cc147595
2 changed files with 5 additions and 2 deletions

View File

@ -16,7 +16,7 @@ from PIL import Image, ImageDraw
import flask
import ldap
from webapp import context, ldaputils
from webapp import context, ldaputils, config
bp = flask.Blueprint('avatar', __name__)
log = logging.getLogger('ldap-web.avatar')
@ -136,7 +136,7 @@ class AvatarCacheEntry:
def __init__(self, uid: str, data: bytes):
self.uid = uid
self.deadline = time.time() + 3600
self.deadline = time.time() + config.avatar_cache_timeout
self.data = data
self._converted = b""

View File

@ -28,6 +28,9 @@ ldap_active_groups = os.getenv('LDAPWEB_ACTIVE_GROUPS', 'fatty,starving,potato')
ldap_admin_dn = os.getenv('LDAPWEB_ADMIN_DN', 'cn=ldapweb,ou=services,dc=hackerspace,dc=pl')
ldap_admin_password = os.getenv('LDAPWEB_ADMIN_PASSWORD', 'unused')
# avatar server
avatar_cache_timeout = int(os.getenv('LDAPWEB_AVATAR_CACHE_TIMEOUT', '1800'))
# LDAP attribute configuration
readable_names = {