refactor: rename CACHE_DIR → DATA_DIR, container path .if_cache → data (#21)

* refactor: rename CACHE_DIR to DATA_DIR, default path .if_cache → data

CACHE_DIR held both the embedding cache and the SQLite tracker DB, making
the name misleading. DATA_DIR is more accurate.

- Config reads DATA_DIR first; falls back to CACHE_DIR with a deprecation
  warning so existing setups don't break on upgrade
- Default local path: data (was .if_cache)
- Docker default path: /app/data (was /app/.if_cache)
- Internal references (embeddings.py, upload_tracker.py) updated to DATA_DIR
- compose.yml, .env.example, README, wiki, and changelog updated
- Version bumped to 0.5.1

* chore: update lockfile

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
2026-06-14 17:59:48 -04:00
committed by GitHub
co-authored by github-actions[bot]
parent 8f30379262
commit d99d607fc8
10 changed files with 39 additions and 23 deletions
+12 -2
View File
@@ -47,7 +47,7 @@ class _Config:
ENABLE_FACE_ALIGNMENT: bool
ENABLE_CACHE: bool
CACHE_DIR: str
DATA_DIR: str
def __new__(cls) -> "_Config":
if cls._instance is None:
@@ -99,7 +99,17 @@ class _Config:
self.USE_FULL_RESOLUTION = os.getenv("USE_FULL_RESOLUTION", "true").lower() in ("true", "1", "yes")
self.ENABLE_FACE_ALIGNMENT = os.getenv("ENABLE_FACE_ALIGNMENT", "true").lower() in ("true", "1", "yes")
self.ENABLE_CACHE = os.getenv("ENABLE_CACHE", "true").lower() in ("true", "1", "yes")
self.CACHE_DIR = os.getenv("CACHE_DIR", ".if_cache")
_data_dir = os.getenv("DATA_DIR")
_cache_dir_legacy = os.getenv("CACHE_DIR")
if _data_dir:
self.DATA_DIR = _data_dir
elif _cache_dir_legacy:
logging.warning(
"CACHE_DIR is deprecated — rename it to DATA_DIR in your .env or compose.yml"
)
self.DATA_DIR = _cache_dir_legacy
else:
self.DATA_DIR = "data"
# Fall back to config file only when the env var is genuinely absent (None).
# An explicitly empty env var (IMMICH_URL="") takes priority over the file.