Support MIRAGE_CACHE_DIR env variable

This commit is contained in:
miruka
2020-06-11 21:50:26 -04:00
parent d4350f6e86
commit 451abfdf25
2 changed files with 12 additions and 4 deletions

View File

@@ -2,6 +2,7 @@
import asyncio
import logging as log
import os
import sys
import traceback
from pathlib import Path
@@ -102,7 +103,10 @@ class Backend:
self.send_locks: DefaultDict[str, asyncio.Lock] = \
DefaultDict(asyncio.Lock) # {room_id: lock}
cache_dir = Path(self.appdirs.user_cache_dir)
cache_dir = Path(
os.environ.get("MIRAGE_CACHE_DIR") or self.appdirs.user_cache_dir,
)
self.media_cache: MediaCache = MediaCache(self, cache_dir)