drogonframework / drogonframework/drogon

Get env variable from config.json and model.json

Open
#1,888 2 comments 1 reaction 0 assignees View on GitHub
enhancement
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.