Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

README.md

kvstore - a simple key-value store over http

CircleCI Go Report Card

kvstore provides key-value storage over HTTP.

Usage:

kvstore [FLAG]...

Do NOT use to store your secrets.

Basic Usage

Installation

go get -u github.com/peteretelej/kvstore

Launch kvstore server

Create a json file (creds.json) containing a list of accepted credentials/keys that clients will use when getting or setting values.

# create credentials file (json array of strings/credentials)
echo '["credential1","cred2"]' >creds.json

# launches the kvstore store listening on port 8080
kvstore 

Changing server listen address and credentials

# launch store on localhost (local kvstore)
kvstore -listen localhost:8080  

# use a diffent file instead of creds.json
kvstore -creds ~/.kvcreds.json

Using the kvstore

Clients can interact with the kvstore server through:

  • the command line (kvstore cli)
  • HTTP Requests PUT and GET

Use kvstore via command line

A client needs to set the environment variables

  • $KVSTORE with the store endpoint
  • $KVCRED with one of the creds in creds.json

Use the -set and get flags to set and retrieve values.

# export store server endpoint and cred
export KVSTORE=http://localhost:8080
export KVCRED=credential1

# set key value hello=world
kvstore -set -k "hello" -v "world"

# get the value for key hello
kvstore -get -k "hello"

Use kvstore via HTTP requests

Setting key-value: Use PUT request with url form/query values:

  • cred: one of the values in creds.json
  • k: the key to be set
  • v: the value to be set

URL example: PUT http://localhost:8080?cred=credential1&k=hello&v=world

Retrieving a value: Use GET request with the following

  • cred: one of the values in creds.json
  • k: the key whose value you want

URL example: GET http://localhost:8080?cred=credential1&k=hello

About

A stupid-simple key-value store over http

Topics

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.