mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Config: Improve env config to support multi values. v7.0.2 (#4092)
1. add on_connect & on_close directives to conf/full.conf; 2. let http_hooks env overwrite support multi values; e.g. SRS_VHOST_HTTP_HOOKS_ON_CONNECT="http://127.0.0.1/api/connect http://localhost/api/connect" related to https://github.com/ossrs/srs/issues/1222#issuecomment-2170424703 Above comments said `http_hook` env may not works as expected, as I found there are still has some issue in `http_hooks` env configuration, but this PR may not target above problem. --------- Co-authored-by: winlin <winlinvip@gmail.com>
This commit is contained in:
parent
2e211f6abe
commit
16e569d823
4 changed files with 47 additions and 14 deletions
|
@ -68,15 +68,17 @@ const char* _srs_version = "XCORE-" RTMP_SIG_SRS_SERVER;
|
|||
#define SRS_OVERWRITE_BY_ENV_MILLISECONDS(key) if (!srs_getenv(key).empty()) return (srs_utime_t)(::atoi(srs_getenv(key).c_str()) * SRS_UTIME_MILLISECONDS)
|
||||
#define SRS_OVERWRITE_BY_ENV_FLOAT_SECONDS(key) if (!srs_getenv(key).empty()) return srs_utime_t(::atof(srs_getenv(key).c_str()) * SRS_UTIME_SECONDS)
|
||||
#define SRS_OVERWRITE_BY_ENV_FLOAT_MILLISECONDS(key) if (!srs_getenv(key).empty()) return srs_utime_t(::atof(srs_getenv(key).c_str()) * SRS_UTIME_MILLISECONDS)
|
||||
#define SRS_OVERWRITE_BY_ENV_DIRECTIVE(key) { \
|
||||
static SrsConfDirective* dir = NULL; \
|
||||
if (!dir && !srs_getenv(key).empty()) { \
|
||||
string v = srs_getenv(key); \
|
||||
dir = new SrsConfDirective(); \
|
||||
dir->name = key; \
|
||||
dir->args.push_back(v); \
|
||||
} \
|
||||
if (dir) return dir; \
|
||||
#define SRS_OVERWRITE_BY_ENV_DIRECTIVE(key) { \
|
||||
static SrsConfDirective* dir = NULL; \
|
||||
if (!dir && !srs_getenv(key).empty()) { \
|
||||
std::vector<string> vec = srs_string_split(srs_getenv(key), " "); \
|
||||
dir = new SrsConfDirective(); \
|
||||
dir->name = key; \
|
||||
for (size_t i = 0; i < vec.size(); ++i) { \
|
||||
dir->args.push_back(vec[i]); \
|
||||
} \
|
||||
} \
|
||||
if (dir) return dir; \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue