0b3ab76405
Immich connections stay server-side with an encrypted API key, albums can be imported, and photos are only sent back when an event's push button is pressed: originals upload once, edited photos re-render, and edits hashes plus checksums skip anything already in Immich. This also lands the accompanying editor, cloud and administration work that was still uncommitted. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
93 lines
3.7 KiB
JavaScript
93 lines
3.7 KiB
JavaScript
import os from 'node:os';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
export const ROOT = path.resolve(here, '..');
|
|
|
|
/** Read a Luminary setting, falling back to its pre-rebrand LUMENROOM_ name. */
|
|
function setting(name, fallback = '') {
|
|
return process.env[`LUMINARY_${name}`] || process.env[`LUMENROOM_${name}`] || fallback;
|
|
}
|
|
|
|
const dataDir = setting('DATA');
|
|
export const DATA_DIR = dataDir ? path.resolve(dataDir) : path.join(here, 'data');
|
|
|
|
export const ORIGINAL_DIR = path.join(DATA_DIR, 'originals');
|
|
export const PREVIEW_DIR = path.join(DATA_DIR, 'previews');
|
|
export const THUMB_DIR = path.join(DATA_DIR, 'thumbs');
|
|
// Keep the original filename so an existing catalog opens without a migration.
|
|
export const DB_PATH = path.join(DATA_DIR, 'lumenroom.db');
|
|
export const DIST_DIR = path.join(ROOT, 'dist');
|
|
|
|
export const PORT = Number(process.env.PORT || 8787);
|
|
export const HOST = process.env.HOST || '0.0.0.0';
|
|
|
|
/** Shared invite code required to register after the first account exists. */
|
|
export const INVITE = setting('INVITE');
|
|
|
|
/** Base URL of the dashboard this editor is bridged to, e.g. http://hub:3000. */
|
|
export const GLENLOCH_URL = (process.env.GLENLOCH_URL || '').replace(/\/+$/, '');
|
|
|
|
/** Shared HMAC secret for bridge tokens; must match the dashboard's value. */
|
|
export const BRIDGE_SECRET = process.env.BRIDGE_SECRET || '';
|
|
|
|
|
|
/** Optional key for encrypting saved SMTP and bridge credentials at rest. */
|
|
export const SECRET_KEY = setting('SECRET_KEY');
|
|
|
|
/** Trust X-Forwarded-For for rate limits; only behind a proxy that sets it. */
|
|
export const TRUST_PROXY = setting('TRUST_PROXY') === '1';
|
|
|
|
/** How long an imported bridge event survives without being reopened. */
|
|
export const BRIDGE_TTL_HOURS = Number(setting('BRIDGE_TTL_HOURS', '12'));
|
|
|
|
/** Upload ceiling in bytes (300 MB default, bigger than any consumer raw). */
|
|
export const MAX_UPLOAD = Number(setting('MAX_UPLOAD', String(300 * 1024 * 1024)));
|
|
|
|
/** Per-account storage allowance. 100 GiB unless the admin changes it. */
|
|
export const QUOTA_BYTES = Number(setting('QUOTA_BYTES', String(100 * 1024 * 1024 * 1024)));
|
|
|
|
/** Fraction of the quota at which the account is warned (0.9 = 90%). */
|
|
export const QUOTA_WARN_RATIO = Math.min(
|
|
0.99,
|
|
Math.max(0.5, Number(setting('QUOTA_WARN_RATIO', '0.9')) || 0.9),
|
|
);
|
|
|
|
/** Scheduled prunes always leave at least this much room below the cap. */
|
|
export const QUOTA_TARGET_RATIO = Math.min(
|
|
0.95,
|
|
Math.max(0.5, Number(setting('QUOTA_TARGET_RATIO', '0.8')) || 0.8),
|
|
);
|
|
|
|
/** Public URL used in notification emails. Empty falls back to localhost. */
|
|
export const PUBLIC_URL = setting('PUBLIC_URL').replace(/\/+$/, '');
|
|
|
|
/** Gmail SMTP defaults; the admin can override these in Administration. */
|
|
export const SMTP_HOST = setting('SMTP_HOST', 'smtp.gmail.com');
|
|
export const SMTP_PORT = Number(setting('SMTP_PORT', '465'));
|
|
export const SMTP_SECURE = setting('SMTP_SECURE', 'true') !== 'false';
|
|
export const SMTP_USER = setting('SMTP_USER');
|
|
export const SMTP_APP_PASSWORD = setting('SMTP_APP_PASSWORD');
|
|
export const SMTP_FROM = setting('SMTP_FROM', SMTP_USER);
|
|
|
|
/** Long edge used for the editable proxy of raw files. */
|
|
export const RAW_PREVIEW_EDGE = Number(setting('RAW_EDGE', '6000'));
|
|
|
|
export const SESSION_DAYS = 30;
|
|
|
|
/** How many raws decode at once. One core is left for the HTTP server. */
|
|
export const RAW_WORKERS = Math.max(
|
|
1,
|
|
Number(
|
|
setting(
|
|
'RAW_WORKERS',
|
|
String(Math.min(4, Math.max(1, (os.availableParallelism?.() ?? os.cpus().length) - 1))),
|
|
),
|
|
),
|
|
);
|
|
|
|
/** Idle decoder workers are disposed after this long to release memory. */
|
|
export const RAW_IDLE_MS = Number(setting('RAW_IDLE_MS', '90000'));
|