0.1.5 • Published 10 years ago

pohjanmaa v0.1.5

Weekly downloads
2
License
MIT
Repository
-
Last release
10 years ago

pohjanmaa

serve, save and update a set of configs atomically.

Pohjanmaa is a config server based on redis that allows for atomic updates of configs based on key paths.

install

git clone http://github.com/brikteknologier/pohjanmaa
node pohjanmaa

Pohjanmaa is based on redis, so you should have a redis server running. You can configure the redis server by using the --redis-port and --redis-host options when starting pohjanmaa.

usage

{
  port: 5002,
  otherThing: {
    port: 2005
  }
}

Let's say this is our config for amazing_cow_server. OK! Lets save it in Pohjanmaa.

POST /amazing_cow_server
// request body follows
{
  "port": 5002,
  "otherThing": {
    "port": 2005
  }
}
GET /amazing_cow_server

response:
{
  "port": 5002,
  "otherThing": {
    "port": 2005
  }
}
GET /amazing_cow_server/port

response:
5002

What about a nested setting:

GET /amazing_cow_server/otherThing.port

response:
2005
PUT /amazing_cow_server/port
// request body follows
10501

Awesome! What about a nested setting?

PUT /amazing_cow_server/otherThing.port
// request body follows
20502
DELETE /amazing_cow_server/otherThing.port

>> 204 (no content)
PUT /amazing_cow_server
// request body follows
{ "cows": 500 }
POST /_default
// request body follows
{ "aws-credentials": { "super-secret-stuff": "johanna" } }

Awesome! Now when I get one of those other configs we created, I get that stuff too!

GET /amazing_cow_server

response
{
  "cows": 500,
  "aws-credentials": {
    "super-secret-stuff": "johanna"
  }
}

Outstanding. And now you know how to use Pohjanmaa! Pretty sweet, huh?