SPB Git

Repository Public

main.ts 2.6 KB 57 lines typescript

1/**2 * =============================================================================3 *                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : MacLustr Social Engine & Remote Navigator8 * File             : workers/navigator-worker/src/main.ts9 * Module           : workers10 * Repository       : https://git.spboucher.ai/maclustr-social11 * Project Website  : https://social.spboucher.ai12 * Created          : 2026-12-0113 * Last Modified    : 2026-12-0114 *15 * Author           : Simon-Pierre Boucher16 * Position         : Professor of Finance17 * Institution      : Université du Québec en Outaouais (UQO)18 * Organization     : SP Boucher19 * Website          : https://spboucher.ai20 * Git              : https://git.spboucher.ai21 *22 * Preferred Contact: admin@spboucher.ai23 * Technical Contact: dev@spboucher.ai24 * Security/Admin   : admin@spboucher.ai25 *26 * Copyright (c) 202627 * Simon-Pierre Boucher28 * All rights reserved where applicable. This file is governed by the29 * applicable project license, copyright notices and relevant law.30 * Existing third-party rights and notices remain unaffected.31 *32 * License          : None specified (no license file in this repository)33 *34 * Do not embed credentials, private keys, access tokens,35 * certificates or confidential personal information.36 *37 * =============================================================================38 * END OF SP BOUCHER SOURCE HEADER39 * =============================================================================40 */4142import { readFileSync } from 'node:fs';43import { homedir } from 'node:os';44import { join } from 'node:path';45import { NavigatorWorker } from './worker.ts';46const env = (k: string, d: string) => process.env[k] ?? d;47const cfgDir = env('MLS_WORKER_CONFIG_DIR', join(homedir(), '.config', 'maclustr-navigator-worker'));48const w = new NavigatorWorker({49  controlUrl: env('MLS_CONTROL_INTERNAL_URL', 'http://127.0.0.1:8880'), gatewayWsUrl: env('MLS_GATEWAY_WS_URL', 'ws://127.0.0.1:8882/worker'),50  token: readFileSync(env('MLS_WORKER_TOKEN_FILE', join(cfgDir, 'worker.token')), 'utf8').trim(),51  profilesDir: env('MLS_PROFILES_DIR', join(homedir(), 'maclustr-navigator-profiles')), headed: env('MLS_HEADED', '1') !== '0', version: env('MLS_VERSION', '0.1.0'),52  axBridge: env('MLS_AX_BRIDGE', ''),53});54await w.start();55console.log(JSON.stringify({ msg: 'navigator-worker prêt', headed: env('MLS_HEADED', '1') !== '0' }));56for (const sig of ['SIGTERM', 'SIGINT'] as const) process.on(sig, async () => { await w.stop(); process.exit(0); });57
Files main
Menu

Theme