npm package: @konsumation/konsum
Description: Collect resource usage in a home environment
Latest version: 6.11.34

[![npm](https://img.shields.io/npm/v/@konsumation/konsum.svg)](https://www.npmjs.com/package/@konsumation/konsum)
[![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript\&label\&labelColor=blue\&color=555555)](https://typescriptlang.org)
[![bundlejs](https://deno.bundlejs.com/?q=@konsumation/konsum\&badge=detailed)](https://bundlejs.com/?q=@konsumation/konsum)
[![downloads](http://img.shields.io/npm/dm/@konsumation/konsum.svg?style=flat-square)](https://npmjs.org/package/@konsumation/konsum)
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fkonsumation%2Fkonsum%2Fbadge\&style=flat)](https://actions-badge.atrox.dev/konsumation/konsum/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/konsumation/konsum/badge.svg)](https://snyk.io/test/github/konsumation/konsum)
[![Coverage Status](https://coveralls.io/repos/konsumation/konsum/badge.svg)](https://coveralls.io/github/konsumation/konsum)

# konsum

Collect resource usage in a home environment.

# run

## start server

```shell
konsum --config=<<some dir>> start
```

## list

```shell
konsum --config=<<some dir>> list [category]
```

```shell
konsum --config=<<some dir>> insert category value [time]
```

## create backup

```shell
konsum --config=<<some dir>> backup [file]
```

## restore backup

```shell
konsum --config=<<some dir>> restore [file]
```

# install

```shell
npm -g install konsum
```

# create a linux package

```shell
npx npm-pkgbuild
```

# how to configure

# create self signed cert

```shell
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
```

# JWT

# token setup

```shell
openssl genrsa -out demo.rsa 2048
openssl rsa -in demo.rsa -pubout > demo.rsa.pub
```

test with:

```shell
TOKEN=$(curl -s -H "Content-Type: application/json" \
     -d '{"username":"admin","password":"start123"}' \
     -X POST http://localhost:12345/authenticate|jq -r .access_token)
```

and exec a request

```shell
curl -H "Authorization: Bearer $TOKEN" \
     http://localhost:12345/category
```

```shell
TOKEN=...
CATEGORY=...
curl -H "Authorization: Bearer $TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"value":"1234.5","time":"1995-12-17T03:24:00"}' \
     http://localhost:12345/category/$CATEGORY/value
```

Or directly calling the executable

```shell
konsum insert ev 90091.3 '2019-06-22T13:44:17'
```

# openapi

see [openapi](https://konsumation.github.io/index.html)

# API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

*   [addRoute](#addroute)
*   [addRoute](#addroute-1)
*   [addRoute](#addroute-2)
*   [addRoute](#addroute-3)
*   [addRoute](#addroute-4)
*   [addRoute](#addroute-5)
*   [addRoute](#addroute-6)

## addRoute

Stop konsum server.

## addRoute

Reload konsum systemd config.

## addRoute

Create backup on server.

## addRoute

Backup data as text.

## addRoute

Create token.

## addRoute

Retrieve service state.

## addRoute

Login to request api token.
At least one entitlement starting with "konsum" is required.