UNPKG

@kronos-integration/service-systemd

Version:
164 lines (103 loc) 6.32 kB
[![npm](https://img.shields.io/npm/v/@kronos-integration/service-systemd.svg)](https://www.npmjs.com/package/@kronos-integration/service-systemd) [![License](https://img.shields.io/badge/License-0BSD-blue.svg)](https://spdx.org/licenses/0BSD.html) [![bundlejs](https://deno.bundlejs.com/?q=@kronos-integration/service-systemd\&badge=detailed)](https://bundlejs.com/?q=@kronos-integration/service-systemd) [![downloads](http://img.shields.io/npm/dm/@kronos-integration/service-systemd.svg?style=flat-square)](https://npmjs.org/package/@kronos-integration/service-systemd) [![GitHub Issues](https://img.shields.io/github/issues/Kronos-Integration/service-systemd.svg?style=flat-square)](https://github.com/Kronos-Integration/service-systemd/issues) [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FKronos-Integration%2Fservice-systemd%2Fbadge\&style=flat)](https://actions-badge.atrox.dev/Kronos-Integration/service-systemd/goto) [![Styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) [![Known Vulnerabilities](https://snyk.io/test/github/Kronos-Integration/service-systemd/badge.svg)](https://snyk.io/test/github/Kronos-Integration/service-systemd) # @kronos-integration/service-systemd kronos systemd integration * sync node state to systemd with notify (done) * propagate config into kronos (done) * propagate socket activations into kronos (partly) * start / stop / restart / reload initiated from systemd (partly) * log into journal (done) # usage # API <!-- Generated by documentation.js. Update this documentation by updating the source code. --> ### Table of Contents * [JournalLogger](#journallogger) * [logEntry](#logentry) * [Parameters](#parameters) * [FileDescriptor](#filedescriptor) * [Properties](#properties) * [credentialsDirectory](#credentialsdirectory) * [SystemdConfig](#systemdconfig) * [Properties](#properties-1) * [listeningFileDescriptors](#listeningfiledescriptors) * [loadConfig](#loadconfig) * [ServiceSystemd](#servicesystemd) * [Parameters](#parameters-1) * [registerService](#registerservice) * [Parameters](#parameters-2) * [getCredential](#getcredential) * [Parameters](#parameters-3) * [getCredentials](#getcredentials) * [Parameters](#parameters-4) * [endpoints](#endpoints) ## JournalLogger **Extends ServiceLogger** Forward logs entries to the journal. ### logEntry Pass to systemd journal. #### Parameters * `entry` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20; ## FileDescriptor Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) ### Properties * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**&#x20; * `fd` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**&#x20; ## credentialsDirectory Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) ## SystemdConfig **Extends ServiceConfig** Provides config from CONFIGURATION\_DIRECTORY. Also injects listeningFileDescriptors into the config ### Properties * `configurationDirectory` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** taken from CONFIGURATION\_DIRECTORY ### listeningFileDescriptors listeningFileDescriptors as passed in LISTEN\_FDS and LISTEN\_FDNAMES. Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[FileDescriptor](#filedescriptor)>**&#x20; ### loadConfig Load config from configuration dir. Additionally pass listeninfFileDescriptions into config. ## ServiceSystemd **Extends ServiceProviderMixin(Service, JournalLogger, SystemdConfig)** Kronos bridge to systemd: * sync node state to systemd with notify * propagate config into kronos world * propagate socket activations into kronos (partly) * start / stop / restart / reload initiated from systemd * log into journal ### Parameters * `config` (optional, default `{}`) * `ic` &#x20; ### registerService When in debug mode; every sevice gets the logLevel of the service provider. #### Parameters * `service` **Service**&#x20; ### getCredential Deliver credential as provided by systemd. #### Parameters * `key` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20; * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?**&#x20; 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))>**&#x20; ### getCredentials Deliver credentials as provided by systemd. #### Parameters * `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)>**&#x20; * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?**&#x20; 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))>>**&#x20; ### endpoints Definition of the predefined endpoints. * info *in* Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** predefined endpoints # install With [npm](http://npmjs.org) do: ```shell npm install @kronos-integration/service-systemd ``` # license BSD-2-Clause