Commit 3d25ede4 by zhlong

为API添加获取配置型内容的接口

parent f0a538d3
......@@ -102,6 +102,13 @@ API_EXPORT void API_CALL mk_env_init1(int thread_num,
API_EXPORT void API_CALL mk_set_option(const char *key, const char *val);
/**
* 获取配置项的值
* @param key 配置项名
*/
API_EXPORT const char * API_CALL mk_get_option(const char *key);
/**
* 创建http[s]服务器
* @param port htt监听端口,推荐80,传入0则随机分配
* @param ssl 是否为ssl类型服务器
......
......@@ -119,6 +119,17 @@ API_EXPORT void API_CALL mk_set_option(const char *key, const char *val) {
mINI::Instance()[key] = val;
}
API_EXPORT const char * API_CALL mk_get_option(const char *key)
{
assert(key);
if (mINI::Instance().find(key) == mINI::Instance().end()) {
WarnL << "key:" << key << " not existed!";
return nullptr;
}
return mINI::Instance()[key].data();
}
API_EXPORT uint16_t API_CALL mk_http_server_start(uint16_t port, int ssl) {
ssl = MAX(0,MIN(ssl,1));
try {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论