Mini cloud config to manage configurations.
This project is usable, it is constantly evolving to make it more robust, easier to use with the integration of an API and dependencies in popular languages such as java and javascript.
Mini Cloud Config is completely free and Open Source, usable in the cloud, on large projects on microservices... .
The configuration is very easy to understand, just fill in the settings.json file in the confs/ folder. You can have several environments (a different name each time), each environment can have several applications (you cannot have the same application name on each environment) and each application has several secerts (you cannot have secrets same name).
[
{
"environment": "dev",
"description": "test dev",
"authenticationType": "api-key",
"authenticationSecret": "My-Super-Secret",
"applications": [
{
"name": "users-api",
"description": "secrets for users api",
"secrets": [
{ "key": "elasticsearch.port", "value": "9200", "description": "elasticsearch port"},
{ "key": "elasticsearch.url", "value": "https://xxxx", "description": "elasticsearch url"},
{"key": "elasticsearch.user", "value": "admin", "description": "elasticsearch user access"},
{"key": "elasticsearch.password", "value": "password", "description": "elasticsearch user password"
}
]
}
]
}
]
SECRETS_PORT: Server port, default 9000 if not setted in environments variables.
SECRETS_API_TOKEN: Secret key if you want to use Admin Console, if not setted it generated on server started.
curl --location --request POST 'http://localhost:9000/secrets/dev/users-api/?option=yaml' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'api-key: My-Super-Secret'
2 Options to generate configuration file :
- properties: is a properties files with classical key/value,
- yaml: is a yaml file
If no option in request param, the response is a json file.
Today two authentication : token (in query param of url) and by api-key (in the headers of the request)
For example in a entrypoint.sh, you mut set ENV like : dev, prod, prep, qa... and the API_KEY of your mini-cloud-config
#!/bin/bash
echo "Start retreive secrets"
API_KEY= "api-key: $API_KEY"
ACCEPT= "Accept: application/json"
CONTENT_TYPE= "Content-Type: application/json"
URL= "http://URL-MINI-CLOUD-CONFIG:9000/secrets/$ENV/users-api/?option=properties"
curl -X POST --header "$API_KEY" --header "$ACCEPT" --header "$CONTENT_TYPE" "$URL" >> /apps/myapp/resources/application.properties
#start myapp with external properties in param
..
..
..
The configuration file is in /app/mini-cloud-config/confs.
In this folder is the settings.json file, you can add a shared volume on this folder, which must contain the settings.json json file.
The content of this file is very easy to understand.
[
{
"environment": "development",
"description": "development environment for developer",
"authenticationType": "api-key",
"authenticationSecret": "My-Super-Secret",
"applications": [
{
"name": "users-api",
"description": "secrets for users api",
"secrets": [
{
"key": "elasticsearch.port",
"value": "9200",
"description": "default elasticsearch port"
},
{
"key": "elasticsearch.url",
"value": "https://xxxx",
"description": "elasticsearch url"
},
]
}
]
}
]
A web application is available accessible on the path /manage-secrets/index.html.
To be able to use it you must have the access token, the latter is generated when the application starts:
Authorization: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Otherwise set the SECRETS_API_TOKEN variable in the environment variables (when launching the Docker container for example on your machine). You can also and on your development computer in the .env (dotenv) file at the root of the project.