1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

add kafka config

This commit is contained in:
winlin 2015-09-22 15:10:43 +08:00
parent ab1e62a886
commit b5ccc35340
3 changed files with 47 additions and 1 deletions

View file

@ -3488,7 +3488,7 @@ int SrsConfig::check_config()
&& n != "srs_log_tank" && n != "srs_log_level" && n != "srs_log_file"
&& n != "max_connections" && n != "daemon" && n != "heartbeat"
&& n != "http_api" && n != "stats" && n != "vhost" && n != "pithy_print_ms"
&& n != "http_server" && n != "stream_caster"
&& n != "http_server" && n != "stream_caster" && n != "kafka"
&& n != "utc_time"
) {
ret = ERROR_SYSTEM_CONFIG_INVALID;
@ -3530,6 +3530,17 @@ int SrsConfig::check_config()
}
}
}
if (true) {
SrsConfDirective* conf = root->get("kafka");
for (int i = 0; conf && i < (int)conf->directives.size(); i++) {
string n = conf->at(i)->name;
if (n != "enabled") {
ret = ERROR_SYSTEM_CONFIG_INVALID;
srs_error("unsupported kafka directive %s, ret=%d", n.c_str(), ret);
return ret;
}
}
}
if (true) {
SrsConfDirective* conf = get_heartbeart();
for (int i = 0; conf && i < (int)conf->directives.size(); i++) {
@ -4243,6 +4254,23 @@ int SrsConfig::get_stream_caster_rtp_port_max(SrsConfDirective* conf)
return ::atoi(conf->arg0().c_str());
}
bool SrsConfig::get_kafka_enabled()
{
static bool DEFAULT = false;
SrsConfDirective* conf = root->get("kafka");
if (!conf) {
return DEFAULT;
}
conf = conf->get("enabled");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}
return SRS_CONF_PERFER_FALSE(conf->arg0());
}
SrsConfDirective* SrsConfig::get_vhost(string vhost, bool try_default_vhost)
{
srs_assert(root);