Just yet another configuration store, but simpler.
Conman is as standalone http server written in GoLang that stores the configuration in a JSON file. It is ideal for small use cases and can be spun up in most uncomplicated way.
- Watch for file changes at regular intervals
- Watching of file can be configured using HTTP request
- Get & Set configuration using HTTP request
- Basic Authentication
- Clone the repository
git clone https://github.com/orted-org/conman.gitSince there is no dependency to the server, you can simply run the server by
go run *.goThis will run there server on port 4000, set a default API_SECRET as secret@api create a file named temp.json in the current directory and would not watch for file changes.
- Clone the repository
git clone https://github.com/orted-org/conman.gitThe following environment variables are required:
CONMAN_FILENAMEJSON file to get/set configuration (Default:temp.json)CONMAN_WATCH_DURATIONWatch duration for the file changes (Default:-1, indicating not to watch for file changes)CONMAN_API_SECRETAPI secret for basic authentication of the endpoints (Default:secret@api)CONMAN_PORTPort to listen the server (Default:4000)
Wit the following environment variables, you can simply run the server by
go run *.goAdditionally if you want to use Docker, a sample Dockerfile & docker-compose.yml have been included. Make necessary changes and
docker-compose -f docker-compose.yml up --buildThis will run the server on the port specified in docker-compose.yml file or fallback to default port 4000.
Every endpoint must contain the Authorization header in request with in the following form Basic base64-api-secret
Example:
Authorization: Basic c2VjcmV0QGFwaQ==
GET /stats{
"status": 200,
"data": {
"file_name": "./temp.json",
"watch_duration": 0
}
} GET /{
"status": 200,
"data": {
"foo": {
"bar": 30
},
"redis": "13.98.343.90"
}
} GET /foo{
"status": 200,
"data": {
"foo": "bar"
}
} POST /| Parameter | Type | Description |
|---|---|---|
hard |
string |
true/false. If set config to file also |
PUT /watch| Parameter | Type | Description |
|---|---|---|
duration |
number |
required. Time in seconds. -1 to disable watching file changes |
Contributions are always welcome. Please feel free to make a PR or let me know via Email.
Licensed under the MIT license.