@songsid/agend 2.1.1-beta.5 → 2.1.1-beta.6
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/dist/sd-notify.d.ts +11 -0
- package/dist/sd-notify.js +25 -2
- package/dist/sd-notify.js.map +1 -1
- package/package.json +1 -1
- package/templates/systemd.service.ejs +2 -0
package/dist/sd-notify.d.ts
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keep systemd's notification socket private to the fleet process. The socket
|
|
3
|
+
* path is a capability: any child that inherits it can send READY/WATCHDOG/
|
|
4
|
+
* STOPPING on behalf of a NotifyAccess=all service.
|
|
5
|
+
*
|
|
6
|
+
* systemd-notify itself must remain an allowed child sender because Node does
|
|
7
|
+
* not expose AF_UNIX datagram sockets. We therefore remove the capability from
|
|
8
|
+
* the ambient process environment and pass it only to the short-lived helper.
|
|
9
|
+
*/
|
|
10
|
+
export declare function consumeNotifySocket(environment: NodeJS.ProcessEnv): string | undefined;
|
|
11
|
+
export declare function buildNotifyEnvironment(environment: NodeJS.ProcessEnv, socket: string): NodeJS.ProcessEnv;
|
|
1
12
|
export declare function sdNotify(state: string): void;
|
package/dist/sd-notify.js
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
|
+
/**
|
|
3
|
+
* Keep systemd's notification socket private to the fleet process. The socket
|
|
4
|
+
* path is a capability: any child that inherits it can send READY/WATCHDOG/
|
|
5
|
+
* STOPPING on behalf of a NotifyAccess=all service.
|
|
6
|
+
*
|
|
7
|
+
* systemd-notify itself must remain an allowed child sender because Node does
|
|
8
|
+
* not expose AF_UNIX datagram sockets. We therefore remove the capability from
|
|
9
|
+
* the ambient process environment and pass it only to the short-lived helper.
|
|
10
|
+
*/
|
|
11
|
+
export function consumeNotifySocket(environment) {
|
|
12
|
+
const socket = environment.NOTIFY_SOCKET;
|
|
13
|
+
if (socket)
|
|
14
|
+
delete environment.NOTIFY_SOCKET;
|
|
15
|
+
return socket || undefined;
|
|
16
|
+
}
|
|
17
|
+
export function buildNotifyEnvironment(environment, socket) {
|
|
18
|
+
return { ...environment, NOTIFY_SOCKET: socket };
|
|
19
|
+
}
|
|
20
|
+
const notifySocket = consumeNotifySocket(process.env);
|
|
2
21
|
export function sdNotify(state) {
|
|
3
|
-
if (!
|
|
22
|
+
if (!notifySocket)
|
|
4
23
|
return;
|
|
5
24
|
try {
|
|
6
|
-
execFileSync("systemd-notify", [state], {
|
|
25
|
+
execFileSync("systemd-notify", [state], {
|
|
26
|
+
env: buildNotifyEnvironment(process.env, notifySocket),
|
|
27
|
+
stdio: "ignore",
|
|
28
|
+
timeout: 5000,
|
|
29
|
+
});
|
|
7
30
|
}
|
|
8
31
|
catch { /* best effort */ }
|
|
9
32
|
}
|
package/dist/sd-notify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sd-notify.js","sourceRoot":"","sources":["../src/sd-notify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"sd-notify.js","sourceRoot":"","sources":["../src/sd-notify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAA8B;IAChE,MAAM,MAAM,GAAG,WAAW,CAAC,aAAa,CAAC;IACzC,IAAI,MAAM;QAAE,OAAO,WAAW,CAAC,aAAa,CAAC;IAC7C,OAAO,MAAM,IAAI,SAAS,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,WAA8B,EAC9B,MAAc;IAEd,OAAO,EAAE,GAAG,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC;AACnD,CAAC;AAED,MAAM,YAAY,GAAG,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAEtD,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,IAAI,CAAC,YAAY;QAAE,OAAO;IAC1B,IAAI,CAAC;QACH,YAAY,CAAC,gBAAgB,EAAE,CAAC,KAAK,CAAC,EAAE;YACtC,GAAG,EAAE,sBAAsB,CAAC,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC;YACtD,KAAK,EAAE,QAAQ;YACf,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,CAAC;AAC/B,CAAC"}
|
package/package.json
CHANGED