drogonframework / drogonframework/drogon
Get env variable from config.json and model.json
- Dominant language
- C++
- Stars
- 14.3k
- Forks
- 1.4k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 14
Description
Here is a good feature to add ! When building microservice architecture, we often need to build images from dockerfiles and use kubernetes to configure the architecture of services. For host server, host clients and database clients(postgres or redis), the configuration often depends on env variable set with kubernetes and passed to containers.
The standard library can access env variable using std::getenv(char* path), if add it to the method loadConfigFile to get all ${ENV_EXAMPLE} by the corresponded value. for example we can have { host: ${HOST_SERVER}, port: ${PORT} } in the config.json and when call loadConfigFlie("config.json"), load ${HOST_SERVER} by std::getenv("HOST_SERVER") and load ${PORT} by std::getenv("PORT"), the config file should not be modified.
Contributor guide
Assessment
This issue has not been assessed yet.