@kronos-integration/service-systemd 2.7.2 → 2.8.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/README.md +31 -0
- package/package.json +3 -3
- package/src/service.mjs +16 -5
package/README.md
CHANGED
|
@@ -27,11 +27,16 @@ kronos systemd integration
|
|
|
27
27
|
* [JournalLogger](#journallogger)
|
|
28
28
|
* [FileDescriptor](#filedescriptor)
|
|
29
29
|
* [Properties](#properties)
|
|
30
|
+
* [credentialsDirectory](#credentialsdirectory)
|
|
30
31
|
* [SystemdConfig](#systemdconfig)
|
|
31
32
|
* [Properties](#properties-1)
|
|
32
33
|
* [listeningFileDescriptors](#listeningfiledescriptors)
|
|
33
34
|
* [loadConfig](#loadconfig)
|
|
34
35
|
* [ServiceSystemd](#servicesystemd)
|
|
36
|
+
* [getCredential](#getcredential)
|
|
37
|
+
* [Parameters](#parameters)
|
|
38
|
+
* [getCredentials](#getcredentials)
|
|
39
|
+
* [Parameters](#parameters-1)
|
|
35
40
|
* [endpoints](#endpoints)
|
|
36
41
|
|
|
37
42
|
## JournalLogger
|
|
@@ -49,6 +54,10 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
|
|
|
49
54
|
* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
|
|
50
55
|
* `fd` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** 
|
|
51
56
|
|
|
57
|
+
## credentialsDirectory
|
|
58
|
+
|
|
59
|
+
Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
|
|
60
|
+
|
|
52
61
|
## SystemdConfig
|
|
53
62
|
|
|
54
63
|
**Extends ServiceConfig**
|
|
@@ -83,6 +92,28 @@ Kronos bridge to systemd:
|
|
|
83
92
|
* start / stop / restart / reload initiated from systemd
|
|
84
93
|
* log into journal
|
|
85
94
|
|
|
95
|
+
### getCredential
|
|
96
|
+
|
|
97
|
+
Deliver credential as provided by systemd.
|
|
98
|
+
|
|
99
|
+
#### Parameters
|
|
100
|
+
|
|
101
|
+
* `key` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
102
|
+
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
103
|
+
|
|
104
|
+
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<([Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))>** 
|
|
105
|
+
|
|
106
|
+
### getCredentials
|
|
107
|
+
|
|
108
|
+
Deliver credentials as provided by systemd.
|
|
109
|
+
|
|
110
|
+
#### Parameters
|
|
111
|
+
|
|
112
|
+
* `keys` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** 
|
|
113
|
+
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
114
|
+
|
|
115
|
+
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<([Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))>>** 
|
|
116
|
+
|
|
86
117
|
### endpoints
|
|
87
118
|
|
|
88
119
|
Definition of the predefined endpoints.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/service-systemd",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": false
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"cmake-js": "^7.3.1",
|
|
42
42
|
"documentation": "^14.0.3",
|
|
43
43
|
"execa": "^9.6.0",
|
|
44
|
-
"node-addon-api": "^8.
|
|
44
|
+
"node-addon-api": "^8.5.0",
|
|
45
45
|
"semantic-release": "^24.2.0"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
|
-
"node": ">=22.
|
|
48
|
+
"node": ">=22.17.1"
|
|
49
49
|
},
|
|
50
50
|
"os": [
|
|
51
51
|
"linux"
|
package/src/service.mjs
CHANGED
|
@@ -45,7 +45,8 @@ class JournalLogger extends ServiceLogger {
|
|
|
45
45
|
*/
|
|
46
46
|
|
|
47
47
|
const configurationDirectory = process.env.CONFIGURATION_DIRECTORY;
|
|
48
|
-
const credentialsDirectory =
|
|
48
|
+
const /** @typedef {string} */ credentialsDirectory =
|
|
49
|
+
process.env.CREDENTIALS_DIRECTORY;
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
52
|
* Provides config from CONFIGURATION_DIRECTORY.
|
|
@@ -158,13 +159,23 @@ export class ServiceSystemd extends ServiceProviderMixin(
|
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
/**
|
|
161
|
-
* Deliver
|
|
162
|
+
* Deliver credential as provided by systemd.
|
|
162
163
|
* @param {string} key
|
|
163
|
-
* @param {Object} options
|
|
164
|
-
* @return {Promise<
|
|
164
|
+
* @param {Object?} options
|
|
165
|
+
* @return {Promise<Uint8Array|string>}
|
|
165
166
|
*/
|
|
166
167
|
async getCredential(key, options) {
|
|
167
|
-
return readFile(join(credentialsDirectory, key, options)
|
|
168
|
+
return readFile(join(credentialsDirectory, key), options);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Deliver credentials as provided by systemd.
|
|
173
|
+
* @param {string[]} keys
|
|
174
|
+
* @param {Object?} options
|
|
175
|
+
* @return {Promise<(Uint8Array|string)[]>}
|
|
176
|
+
*/
|
|
177
|
+
async getCredentials(keys, options) {
|
|
178
|
+
return Promise.all(keys.map(key => this.getCredential(key, options)));
|
|
168
179
|
}
|
|
169
180
|
|
|
170
181
|
/**
|