'use strict'; const fs = require('node:fs'); const path = require('node:path'); const root = __dirname; const nodePath = (process.env.PATH || '').split(path.delimiter); const npmBin = nodePath .map((directory) => path.join(directory, 'npm')) .find((candidate) => fs.existsSync(candidate)); if (!npmBin) { throw new Error('npm must be available on PATH when starting the GEWU PM2 ecosystem'); } module.exports = { apps: [ { name: 'gewu-api', cwd: root, script: path.join(root, 'scripts/python-tool'), interpreter: '/usr/bin/bash', args: 'uvicorn gewu.bootstrap.app:create_local_app --factory --host 127.0.0.1 --port 8000', env: { GEWU_DATA_ROOT: path.join(root, '.data/gewu'), GEWU_MCP_ALLOWED_HOSTS: 'msi.tail0b014a.ts.net:8443,100.67.41.125:8443', }, autorestart: true, time: true, }, { name: 'gewu-web', cwd: root, script: npmBin, interpreter: 'none', args: '--prefix web run dev -- --host 127.0.0.1', env: {}, autorestart: true, time: true, }, ], };