albion/server/src/config.ts
Заид Омар Медхат 337dac78ba
All checks were successful
Deploy / deploy (push) Successful in 3m58s
Client/server split, Postgres, auth, Windows agent, Docker deploy
- Extract world-parse + packet capture into @albion/shared (reused by
  server and a new standalone agent workspace).
- Migrate the data layer from SQLite/better-sqlite3 to shared Postgres
  (async pg with a ?->$n helper; economy engine preloads the item/recipe
  graph so its sync recursion still works).
- API-key auth (ALBION_API_KEY) on all /api routes except health; web UI
  sends it via a fetch wrapper + key-entry gate; server serves the built
  UI with a path-traversal-safe static handler (drops @fastify/static).
- Windows companion agent: pushes world map + captured market orders to
  /api/ingest/*; runs on the gaming PC where the game traffic lives.
- Docker + docker-compose (external proxy + backend networks for Nginx
  Proxy Manager and shared Postgres) and a Forgejo deploy workflow.
- Validated end-to-end against Postgres 16 and a full compose run.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-23 04:10:08 +05:00

22 lines
875 B
TypeScript

import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
/** Server root directory (server/) */
export const SERVER_ROOT = path.resolve(__dirname, '..');
/** Local data directory (git-ignored): SQLite db + downloaded game data.
* Override with ALBION_DATA_DIR (e.g. a mounted Docker volume). */
export const DATA_DIR = process.env.ALBION_DATA_DIR ?? path.join(SERVER_ROOT, 'data');
export const GAMEDATA_DIR = path.join(DATA_DIR, 'gamedata');
export const DB_PATH = path.join(DATA_DIR, 'app.db');
export const API_PORT = 4310;
/** Albion server region for market data. Overridable in settings later. */
export const DEFAULT_ALBION_SERVER = 'europe';
/** ao-bin-dumps raw file base URL */
export const AO_BIN_DUMPS_BASE =
'https://raw.githubusercontent.com/ao-data/ao-bin-dumps/master';