diff --git a/trunk/Dockerfile b/trunk/Dockerfile index d49c99a07..98c506d71 100644 --- a/trunk/Dockerfile +++ b/trunk/Dockerfile @@ -56,4 +56,6 @@ RUN ldd /usr/local/srs/objs/ffmpeg/bin/ffmpeg && \ # Default workdir and command. WORKDIR /usr/local/srs -CMD ["./objs/srs", "-c", "conf/docker.conf"] +ENV SRS_SRS_LOG_TANK=console SRS_DAEMON=off +CMD ["./objs/srs", "-c", "conf/srs.conf"] + diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index 81542f2ae..e01556c61 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -193,10 +193,10 @@ http_api { # default: off enabled off; # whether enable rpc reload. + # Overwrite by env SRS_HTTP_API_RAW_API_ALLOW_RELOAD # default: off allow_reload off; # whether enable rpc query. - # Overwrite by env SRS_HTTP_API_RAW_API_ALLOW_RELOAD # Always off by https://github.com/ossrs/srs/issues/2653 #allow_query off; # whether enable rpc update. diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index df163121b..6148a4d9d 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -24,6 +24,7 @@ The changelog for SRS. ## SRS 5.0 Changelog +* v5.0, 2022-12-31, Refine default config file for SRS. v5.0.120 * v5.0, 2022-12-26, For [#939](https://github.com/ossrs/srs/issues/939): FLV: Fix bug for header flag gussing. v5.0.119 * v5.0, 2022-12-26, For [#296](https://github.com/ossrs/srs/issues/296): MP3: Convert RTMP(MP3) to WebRTC(OPUS). v5.0.118 * v5.0, 2022-12-25, For [#296](https://github.com/ossrs/srs/issues/296): MP3: Support dump stream information. v5.0.117 diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 0f70ce1ae..ac55f6f86 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -1837,8 +1837,8 @@ srs_error_t SrsConfig::parse_options(int argc, char** argv) } } - // Show help if has any argv - show_help = argc > 1; + // Show help if it has no argv + show_help = argc == 1; for (int i = 1; i < argc; i++) { if ((err = parse_argv(i, argv)) != srs_success) { return srs_error_wrap(err, "parse argv"); @@ -1858,56 +1858,24 @@ srs_error_t SrsConfig::parse_options(int argc, char** argv) fprintf(stdout, "%s\n", RTMP_SIG_SRS_SERVER); exit(0); } - - // first hello message. + + // The first hello message. srs_trace(_srs_version); // Config the env_only_ by env. if (getenv("SRS_ENV_ONLY")) env_only_ = true; - // Try config files as bellow: - // 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 (!env_only_) { - 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); - 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); - if (srs_path_exists(try_config_file)) { - exists_config_file = try_config_file; - break; - } - } - - if (exists_config_file.empty()) { - return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "no config file at %s", srs_join_vector_string(try_config_files, ", ").c_str()); - } - - if (config_file != exists_config_file) { - srs_warn("user config %s does not exists, use %s instead", config_file.c_str(), exists_config_file.c_str()); - config_file = exists_config_file; - } - } - // Overwrite the config by env SRS_CONFIG_FILE. - if (!srs_getenv("srs.config.file").empty()) { - string ov = config_file; - config_file = srs_getenv("srs.config.file"); + if (!env_only_ && !srs_getenv("srs.config.file").empty()) { // SRS_CONFIG_FILE + string ov = config_file; config_file = srs_getenv("srs.config.file"); srs_trace("ENV: Overwrite config %s to %s", ov.c_str(), config_file.c_str()); } + // Make sure config file exists. + if (!env_only_ && !srs_path_exists(config_file)) { + return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "no config file at %s", config_file.c_str()); + } + // Parse the matched config file. if (!env_only_) { err = parse_file(config_file.c_str()); diff --git a/trunk/src/core/srs_core_version5.hpp b/trunk/src/core/srs_core_version5.hpp index 48ac7b5f5..4729765f1 100644 --- a/trunk/src/core/srs_core_version5.hpp +++ b/trunk/src/core/srs_core_version5.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 0 -#define VERSION_REVISION 119 +#define VERSION_REVISION 120 #endif