agent-relay-server 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/daemon.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { execFile } from "node:child_process";
|
|
|
2
2
|
import { constants } from "node:fs";
|
|
3
3
|
import { access, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
|
-
import { dirname, join, resolve } from "node:path";
|
|
5
|
+
import { delimiter, dirname, join, resolve } from "node:path";
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
7
|
import { DEFAULT_HOST, DEFAULT_PORT, defaultEnvFile, defaultLogDir, type SetupEnvironment } from "./setup";
|
|
8
8
|
|
|
@@ -265,6 +265,7 @@ function renderSystemdUnit(options: {
|
|
|
265
265
|
binaryPath: string;
|
|
266
266
|
}): string {
|
|
267
267
|
const execArgs = daemonProgramArgs(options.binaryPath).map(quoteSystemdArg);
|
|
268
|
+
const pathValue = systemdServicePath();
|
|
268
269
|
return [
|
|
269
270
|
`# ${MANAGED_MARKER}`,
|
|
270
271
|
"[Unit]",
|
|
@@ -273,7 +274,8 @@ function renderSystemdUnit(options: {
|
|
|
273
274
|
"",
|
|
274
275
|
"[Service]",
|
|
275
276
|
"Type=simple",
|
|
276
|
-
`EnvironmentFile=${
|
|
277
|
+
`EnvironmentFile=${options.envFile}`,
|
|
278
|
+
`Environment=PATH=${quoteSystemdArg(pathValue)}`,
|
|
277
279
|
`ExecStart=${execArgs.join(" ")}`,
|
|
278
280
|
"Restart=on-failure",
|
|
279
281
|
"RestartSec=2",
|
|
@@ -365,6 +367,21 @@ function daemonProgramArgs(binaryPath: string): string[] {
|
|
|
365
367
|
: [binaryPath];
|
|
366
368
|
}
|
|
367
369
|
|
|
370
|
+
function systemdServicePath(): string {
|
|
371
|
+
const dirs = [
|
|
372
|
+
dirname(process.execPath),
|
|
373
|
+
join(homedir(), ".bun", "bin"),
|
|
374
|
+
join(homedir(), ".npm-global", "bin"),
|
|
375
|
+
"/usr/local/sbin",
|
|
376
|
+
"/usr/local/bin",
|
|
377
|
+
"/usr/sbin",
|
|
378
|
+
"/usr/bin",
|
|
379
|
+
"/sbin",
|
|
380
|
+
"/bin",
|
|
381
|
+
];
|
|
382
|
+
return [...new Set(dirs)].join(delimiter);
|
|
383
|
+
}
|
|
384
|
+
|
|
368
385
|
function defaultBinaryPath(): string {
|
|
369
386
|
const current = process.argv[1];
|
|
370
387
|
if (!current || current.includes("bunx-")) return "agent-relay";
|