Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/junajan/encrypted-key-value-store
Service providing key-value store with encryption functionality
https://github.com/junajan/encrypted-key-value-store
Last synced: 12 days ago
JSON representation
Service providing key-value store with encryption functionality
- Host: GitHub
- URL: https://github.com/junajan/encrypted-key-value-store
- Owner: junajan
- License: mit
- Created: 2019-01-19T11:28:03.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-28T14:38:32.000Z (almost 6 years ago)
- Last Synced: 2024-10-30T07:48:36.420Z (about 2 months ago)
- Language: JavaScript
- Size: 93.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Encrypted key-value store
## Endpoints
Here are common endpoints provided by the service
- `/` - prints a service name
- `/version` - prints a service version
- `/ping` - health endpointAnd here are service related endpoints:
- `GET /store/:id` - get stored value based on provided `:id`
- Id has to be a string and can contain a wildcard character `*` (example: `key-*`)
- While sending a GET request, there has to be provided also `encryption-key` header.
- `POST /store/:id` - save value identified by `:id`
- Id has to be a string.
- While sending a POST request, there has to be provided also `encryption-key` header.
- POST request expects a JSON body which will be stored as an encrypted value in the store.
## How to run in a test mode
```bash
# run test database with encryption service
docker-compose -f docker-compose.test.yaml up -d# list running services
docker-compose -f docker-compose.test.yaml ps# stop services
docker-compose -f docker-compose.test.yaml stop
```## How to run in a production mode
Set up mandatory environment variables:
- `DATABASE_HOST` - PostgreSQL database address
- `DATABASE_PASSWORD` - PostgreSQL database password
- `DATABASE_NAME` - PostgreSQL database nameAnd run service inside a docker container:
```bash
# run service on port 3000
docker-compose up -d
```## Testing
For running integration tests, create a `./config/test.env.json` file with following configuration:
```json
{
"port": 3000,
"database": {
"host": "localhost",
"port": 5432,
"database": "postgres",
"user": "postgres",
"password": "password"
}
}
```Run testing postgresql database and start tests:
```bash
# run db
docker-compose -f db/docker-compose.testdb.yaml up -d# run tests
npm test# test coverage
npm run coverage
```