diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 41c1c2d8ef..983d2f9c84 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2021-12-23, For [#2711](https://github.com/ossrs/srs/issues/2711), Refine the default config file. (#2711). v4.0.208 * v4.0, 2021-12-20, Merge [#2784](https://github.com/ossrs/srs/pull/2784): RTC: Support payload name AV1X/AV1. (#2784)(#2760). v4.0.207 * v4.0, 2021-12-07, Merge [#2771](https://github.com/ossrs/srs/pull/2771): RTC: Fix memory leak when replace rtp packet in cache. (#2771). v4.0.205 * v4.0, 2021-12-06, Merge [#2766](https://github.com/ossrs/srs/pull/2766): RTC: Fix nack encode seqnum. (#2766). v4.0.204 diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 335c11bf10..fa813737ce 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -1982,23 +1982,22 @@ srs_error_t SrsConfig::parse_options(int argc, char** argv) srs_trace(_srs_version); // Try config files as bellow: - // config_file Specified by user, like conf/srs.conf - // try_docker_config Guess by SRS, like conf/docker.conf - // try_fhs_config For FHS, try /etc/srs/srs.conf first, @see https://github.com/ossrs/srs/pull/2711 - if (!srs_path_exists(config_file)) { + // User specified config(not empty), like user/docker.conf + // If user specified *docker.conf, try *srs.conf, like user/srs.conf + // Try the default srs config, defined as SRS_CONF_DEFAULT_COFNIG_FILE, like conf/srs.conf + // Try config for FHS, like /etc/srs/srs.conf @see https://github.com/ossrs/srs/pull/2711 + if (true) { vector try_config_files; if (!config_file.empty()) { try_config_files.push_back(config_file); - if (srs_string_ends_with(config_file, "docker.conf")) { - try_config_files.push_back(srs_string_replace(config_file, "docker.conf", "srs.conf")); - } } - try_config_files.push_back(SRS_CONF_DEFAULT_COFNIG_FILE); - if (srs_string_ends_with(SRS_CONF_DEFAULT_COFNIG_FILE, "docker.conf")) { - try_config_files.push_back(srs_string_replace(SRS_CONF_DEFAULT_COFNIG_FILE, "docker.conf", "srs.conf")); + if (srs_string_ends_with(config_file, "docker.conf")) { + try_config_files.push_back(srs_string_replace(config_file, "docker.conf", "srs.conf")); } + try_config_files.push_back(SRS_CONF_DEFAULT_COFNIG_FILE); try_config_files.push_back("/etc/srs/srs.conf"); + // Match the first exists file. string exists_config_file; for (int i = 0; i < (int) try_config_files.size(); i++) { string try_config_file = try_config_files.at(i); diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 48da553506..288a921350 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 207 +#define VERSION_REVISION 208 #endif