https://github.com/lablup/mini-kvstore
A mini key-value store accessible via HTTP REST API for use in GitHub Actions
https://github.com/lablup/mini-kvstore
Last synced: 2 months ago
JSON representation
A mini key-value store accessible via HTTP REST API for use in GitHub Actions
- Host: GitHub
- URL: https://github.com/lablup/mini-kvstore
- Owner: lablup
- License: mit
- Created: 2024-08-04T12:43:46.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-08-04T13:29:40.000Z (9 months ago)
- Last Synced: 2025-01-03T22:27:25.022Z (4 months ago)
- Language: Python
- Size: 6.84 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mini-kvstore
A mini key-value store accessible via HTTP REST API for use in GitHub Actions## Install
Install using [uv](https://docs.astral.sh/uv/getting-started/):
```sh
uv sync
```## Usage
Create `.env` file containing the following keys:
```
KVSTORE_TOKEN=xxxx-super-secret-token-xxxx
KVSTORE_PORT=443
KVSTORE_SSL_CERT=/path/to/fullchain.pem
KVSTORE_SSL_KEY=/path/to/privkey.pem
```If you omit `KVSTORE_SSL_CERT` and `KVSTORE_SSL_KEY`, the server will run without SSL.
Run `./run.sh` or `uv run server` as root.
## The API
* The key and values are arbitrary strings.
* You have to set the HTTP Bearer token authentication header.
* Set a key: `POST /` with the JSON body like `{"key": "...", "value": "..."}`.
- If the key already exists, it is overwritten.
* Get a key: `GET /?key={key}`
- If the key does not exist, it returns 404.
* Delete a key: `DELETE /?key={key}`
- If the key does not exist, it returns 404.
* Do the health check: `GET /health`## Example
```bash
curl -X POST "https://service-url/" \
-H "Authorization: Bearer xxx-super-secret-token-xxx" \
-H "Content-Type: application/json" \
-d '{"key": "example", "value": "data"}'curl -X GET "https://localhost:8000/?key=example" \
-H "Authorization: Bearer xxx-super-secret-token-xxx"curl -X DELETE "https://localhost:8000/?key=example" \
-H "Authorization: Bearer xxx-super-secret-token-xxx"
```