Files
immich-magic-proxy/shared/src/version.ts
T
2026-10-06 10:07:20 +13:00

16 lines
529 B
TypeScript

import { readFileSync } from 'fs'
/**
* Resolve the running application version. Prefers the APP_VERSION env var
* baked in at Docker build time (see the Dockerfiles); falls back to the
* app's package.json for local dev, and finally to 'dev' if neither is readable.
*/
export function resolveAppVersion (packageJsonPath: string): string {
if (process.env.APP_VERSION) return process.env.APP_VERSION
try {
return JSON.parse(readFileSync(packageJsonPath, 'utf-8')).version || 'dev'
} catch {
return 'dev'
}
}