Initial commit: Luminary photo catalog and RAW editor
Browser-based photo catalog with an optional team server (SQLite + LibRaw). Local database, uploaded photos, build output and dependencies are gitignored. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
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 || '';
|
||||
|
||||
/** 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'));
|
||||
Reference in New Issue
Block a user