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.
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.
- create a config
- read a config
- read a single setting of a config
- update a single setting
- delete a single setting
- update a whole config
- using a default config
{
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?