mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Support config in_docker to fix the detect fail. (#2824). v4.0.216
This commit is contained in:
parent
fd313133b1
commit
7808bd7ca8
6 changed files with 29 additions and 2 deletions
|
@ -2471,7 +2471,7 @@ srs_error_t SrsConfig::check_normal_config()
|
|||
&& n != "grace_start_wait" && n != "empty_ip_ok" && n != "disable_daemon_for_docker"
|
||||
&& n != "inotify_auto_reload" && n != "auto_reload_for_docker" && n != "tcmalloc_release_rate"
|
||||
&& n != "query_latest_version"
|
||||
&& n != "circuit_breaker" && n != "is_full"
|
||||
&& n != "circuit_breaker" && n != "is_full" && n != "in_docker"
|
||||
) {
|
||||
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal directive %s", n.c_str());
|
||||
}
|
||||
|
@ -2999,6 +2999,18 @@ bool SrsConfig::get_daemon()
|
|||
return SRS_CONF_PERFER_TRUE(conf->arg0());
|
||||
}
|
||||
|
||||
bool SrsConfig::get_in_docker()
|
||||
{
|
||||
static bool DEFAULT = false;
|
||||
|
||||
SrsConfDirective* conf = root->get("in_docker");
|
||||
if (!conf) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
return SRS_CONF_PERFER_FALSE(conf->arg0());
|
||||
}
|
||||
|
||||
bool SrsConfig::is_full_config()
|
||||
{
|
||||
static bool DEFAULT = false;
|
||||
|
|
|
@ -382,6 +382,8 @@ public:
|
|||
// If true, SRS will run in daemon mode, fork and fork to reap the
|
||||
// grand-child process to init process.
|
||||
virtual bool get_daemon();
|
||||
// Whether srs in docker.
|
||||
virtual bool get_in_docker();
|
||||
private:
|
||||
// Whether user use full.conf
|
||||
virtual bool is_full_config();
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
|
||||
#define VERSION_MAJOR 4
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_REVISION 215
|
||||
#define VERSION_REVISION 216
|
||||
|
||||
#endif
|
||||
|
|
|
@ -385,6 +385,14 @@ srs_error_t run_directly_or_daemon()
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
// Try to load the config if docker detect failed.
|
||||
if (!_srs_in_docker) {
|
||||
_srs_in_docker = _srs_config->get_in_docker();
|
||||
if (_srs_in_docker) {
|
||||
srs_trace("enable in_docker by config");
|
||||
}
|
||||
}
|
||||
|
||||
// Load daemon from config, disable it for docker.
|
||||
// @see https://github.com/ossrs/srs/issues/1594
|
||||
bool run_as_daemon = _srs_config->get_daemon();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue