mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Config: If docker.conf does not exists, try srs.conf
This commit is contained in:
parent
219198d0ee
commit
5d5df7923b
1 changed files with 10 additions and 0 deletions
|
@ -1984,6 +1984,16 @@ srs_error_t SrsConfig::parse_options(int argc, char** argv)
|
|||
if (config_file.empty()) {
|
||||
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "no config, read help: %s -h", argv[0]);
|
||||
}
|
||||
|
||||
// For docker, if config is not specified, try srs.conf instead.
|
||||
string try_config = srs_string_replace(config_file, "docker.conf", "srs.conf");
|
||||
if (!srs_path_exists(config_file) && try_config != config_file) {
|
||||
if (!srs_path_exists(try_config)) {
|
||||
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "no config file %s or %s", config_file.c_str(), try_config.c_str());
|
||||
}
|
||||
srs_warn("user config %s does not exists, use %s instead", config_file.c_str(), try_config.c_str());
|
||||
config_file = try_config;
|
||||
}
|
||||
|
||||
err = parse_file(config_file.c_str());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue