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

SRS5: Config: Support better env name for prefixed with srs (#3370)

* Actions: Fix github action warnings.

* Forward: Bind the context id of source or stream.

* Config: Support better env names.

PICK a4e7427433

Co-authored-by: pengfei.ma <pengfei.ma@ctechm.com>
Co-authored-by: Haibo Chen <495810242@qq.com>
This commit is contained in:
Winlin 2023-01-11 10:39:05 +08:00 committed by winlin
parent f46231cf3e
commit 498ce72af8
8 changed files with 53 additions and 13 deletions

View file

@ -1919,7 +1919,7 @@ srs_error_t SrsConfig::parse_options(int argc, char** argv)
// If use env only, we set change to daemon(off) and console log.
if (env_only_) {
if (!getenv("SRS_DAEMON")) setenv("SRS_DAEMON", "off", 1);
if (!getenv("SRS_SRS_LOG_TANK")) setenv("SRS_SRS_LOG_TANK", "console", 1);
if (!getenv("SRS_SRS_LOG_TANK") && !getenv("SRS_LOG_TANK")) setenv("SRS_SRS_LOG_TANK", "console", 1);
if (root->directives.empty()) root->get_or_create("vhost", "__defaultVhost__");
}
@ -6340,9 +6340,12 @@ extern bool _srs_in_docker;
bool SrsConfig::get_log_tank_file()
{
if (!srs_getenv("srs.srs_log_tank").empty()) { // SRS_
if (!srs_getenv("srs.srs_log_tank").empty()) { // SRS_SRS_LOG_TANK
return srs_getenv("srs.srs_log_tank") != "console";
}
if (!srs_getenv("srs.log_tank").empty()) { // SRS_LOG_TANK
return srs_getenv("srs.log_tank") != "console";
}
static bool DEFAULT = true;
@ -6361,6 +6364,7 @@ bool SrsConfig::get_log_tank_file()
string SrsConfig::get_log_level()
{
SRS_OVERWRITE_BY_ENV_STRING("srs.srs_log_level"); // SRS_SRS_LOG_LEVEL
SRS_OVERWRITE_BY_ENV_STRING("srs.log_level"); // SRS_LOG_LEVEL
static string DEFAULT = "trace";
@ -6375,6 +6379,7 @@ string SrsConfig::get_log_level()
string SrsConfig::get_log_level_v2()
{
SRS_OVERWRITE_BY_ENV_STRING("srs.srs_log_level_v2"); // SRS_SRS_LOG_LEVEL_V2
SRS_OVERWRITE_BY_ENV_STRING("srs.log_level_v2"); // SRS_LOG_LEVEL_V2
static string DEFAULT = "";
@ -6389,6 +6394,7 @@ string SrsConfig::get_log_level_v2()
string SrsConfig::get_log_file()
{
SRS_OVERWRITE_BY_ENV_STRING("srs.srs_log_file"); // SRS_SRS_LOG_FILE
SRS_OVERWRITE_BY_ENV_STRING("srs.log_file"); // SRS_LOG_FILE
static string DEFAULT = "./objs/srs.log";