@kronos-integration/service-systemd 2.6.3 → 2.7.0
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/LICENSE +12 -23
- package/README.md +1 -1
- package/package.json +7 -7
- package/src/service.mjs +21 -16
- package/systemd-linux-arm64.node +0 -0
- package/systemd-linux-arm64.node.001 +0 -0
- package/systemd-linux-arm64.node.002 +0 -0
- package/systemd-linux-arm64.node.003 +0 -0
- package/systemd-linux-arm64.node.004 +0 -0
- package/systemd-linux-arm64.node.005 +0 -0
package/LICENSE
CHANGED
|
@@ -1,23 +1,12 @@
|
|
|
1
|
-
Copyright (
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
15
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
16
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
17
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
18
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
19
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
20
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
21
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
22
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
23
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1
|
+
Copyright (C) 2019-2025 by arlac77
|
|
2
|
+
|
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
4
|
+
purpose with or without fee is hereby granted.
|
|
5
|
+
|
|
6
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
7
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
8
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
9
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
10
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
11
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
12
|
+
PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://spdx.org/licenses/0BSD.html)
|
|
2
2
|
[](https://github.com/Kronos-Integration/service-systemd/issues)
|
|
3
3
|
[](https://actions-badge.atrox.dev/Kronos-Integration/service-systemd/goto)
|
|
4
4
|
[](https://github.com/prettier/prettier)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/service-systemd",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": false
|
|
@@ -32,20 +32,20 @@
|
|
|
32
32
|
"build": "cmake-js compile"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@kronos-integration/service": "^11.2.
|
|
35
|
+
"@kronos-integration/service": "^11.2.8",
|
|
36
36
|
"config-expander": "^14.0.9"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"ava": "^6.
|
|
39
|
+
"ava": "^6.3.0",
|
|
40
40
|
"c8": "^10.1.2",
|
|
41
|
-
"cmake-js": "^7.3.
|
|
41
|
+
"cmake-js": "^7.3.1",
|
|
42
42
|
"documentation": "^14.0.3",
|
|
43
|
-
"execa": "^9.
|
|
44
|
-
"node-addon-api": "^8.
|
|
43
|
+
"execa": "^9.6.0",
|
|
44
|
+
"node-addon-api": "^8.3.1",
|
|
45
45
|
"semantic-release": "^24.2.0"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
|
-
"node": ">=22.
|
|
48
|
+
"node": ">=22.14.0"
|
|
49
49
|
},
|
|
50
50
|
"os": [
|
|
51
51
|
"linux"
|
package/src/service.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { arch, constants } from "node:os";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
2
4
|
import { Module } from "node:module";
|
|
3
5
|
import { expand } from "config-expander";
|
|
4
6
|
import {
|
|
@@ -13,12 +15,8 @@ const filename = new URL(`../systemd-linux-${arch()}.node`, import.meta.url)
|
|
|
13
15
|
const m = new Module(filename);
|
|
14
16
|
m.filename = filename;
|
|
15
17
|
process.dlopen(m, filename, constants.dlopen.RTLD_NOW);
|
|
16
|
-
const {
|
|
17
|
-
|
|
18
|
-
notify_with_fds,
|
|
19
|
-
notify,
|
|
20
|
-
journal_print_object
|
|
21
|
-
} = m.exports;
|
|
18
|
+
const { LISTEN_FDS_START, notify_with_fds, notify, journal_print_object } =
|
|
19
|
+
m.exports;
|
|
22
20
|
|
|
23
21
|
export { notify, notify_with_fds, journal_print_object };
|
|
24
22
|
|
|
@@ -40,12 +38,15 @@ class JournalLogger extends ServiceLogger {
|
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
/**
|
|
43
|
-
*
|
|
41
|
+
*
|
|
44
42
|
* @typedef {Object} FileDescriptor
|
|
45
43
|
* @property {string?} name
|
|
46
44
|
* @property {number} fd
|
|
47
45
|
*/
|
|
48
46
|
|
|
47
|
+
const configurationDirectory = process.env.CONFIGURATION_DIRECTORY;
|
|
48
|
+
const credentialsDirectory = process.env.CREDENTIALS_DIRECTORY;
|
|
49
|
+
|
|
49
50
|
/**
|
|
50
51
|
* Provides config from CONFIGURATION_DIRECTORY.
|
|
51
52
|
* Also injects listeningFileDescriptors into the config
|
|
@@ -59,8 +60,6 @@ class SystemdConfig extends ServiceConfig {
|
|
|
59
60
|
static get description() {
|
|
60
61
|
return "Synchronize configuration with systemd";
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
-
configurationDirectory = process.env.CONFIGURATION_DIRECTORY;
|
|
64
63
|
|
|
65
64
|
/**
|
|
66
65
|
* listeningFileDescriptors as passed in LISTEN_FDS and LISTEN_FDNAMES.
|
|
@@ -88,12 +87,12 @@ class SystemdConfig extends ServiceConfig {
|
|
|
88
87
|
*/
|
|
89
88
|
async loadConfig() {
|
|
90
89
|
notify("RELOADING=1");
|
|
91
|
-
if (
|
|
92
|
-
this.trace(`load: ${
|
|
90
|
+
if (configurationDirectory) {
|
|
91
|
+
this.trace(`load: ${configurationDirectory}/config.json`);
|
|
93
92
|
await this.configure(
|
|
94
93
|
await expand("${include('config.json')}", {
|
|
95
94
|
constants: {
|
|
96
|
-
basedir:
|
|
95
|
+
basedir: configurationDirectory
|
|
97
96
|
},
|
|
98
97
|
default: {}
|
|
99
98
|
})
|
|
@@ -112,7 +111,10 @@ class SystemdConfig extends ServiceConfig {
|
|
|
112
111
|
async _stop() {
|
|
113
112
|
const lfd = this.listeningFileDescriptors;
|
|
114
113
|
const state = "FDSTORE=1" + lfd.map(l => `\nFDNAME=${l.name}`).join("");
|
|
115
|
-
const rc = notify_with_fds(
|
|
114
|
+
const rc = notify_with_fds(
|
|
115
|
+
state,
|
|
116
|
+
lfd.map(l => l.fd)
|
|
117
|
+
);
|
|
116
118
|
this.info(`${state} (${rc})`);
|
|
117
119
|
|
|
118
120
|
return super._stop();
|
|
@@ -155,6 +157,10 @@ export class ServiceSystemd extends ServiceProviderMixin(
|
|
|
155
157
|
return true;
|
|
156
158
|
}
|
|
157
159
|
|
|
160
|
+
async getCredential(key) {
|
|
161
|
+
return readFile(join(credentialsDirectory, key));
|
|
162
|
+
}
|
|
163
|
+
|
|
158
164
|
/**
|
|
159
165
|
* Definition of the predefined endpoints.
|
|
160
166
|
* - info _in_
|
|
@@ -197,9 +203,8 @@ export class ServiceSystemd extends ServiceProviderMixin(
|
|
|
197
203
|
break;
|
|
198
204
|
}
|
|
199
205
|
}
|
|
200
|
-
|
|
201
|
-
details()
|
|
202
|
-
{
|
|
206
|
+
|
|
207
|
+
details() {
|
|
203
208
|
return this.toJSONWithOptions({
|
|
204
209
|
includeRuntimeInfo: true,
|
|
205
210
|
includeDefaults: true,
|
package/systemd-linux-arm64.node
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|