mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
api secret无效时不再直接退出程序
而是修改为随机字符串并持久化至配置文件
This commit is contained in:
parent
a7d95461ee
commit
aac8905619
@ -351,10 +351,13 @@ int start_main(int argc,char *argv[]) {
|
|||||||
#endif //defined(ENABLE_SRT)
|
#endif //defined(ENABLE_SRT)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto secret = mINI::Instance()[API::kSecret];
|
auto &secret = mINI::Instance()[API::kSecret];
|
||||||
if (secret == "035c73f7-bb6b-4889-a715-d9eb2d1925cc" || secret.empty()) {
|
if (secret == "035c73f7-bb6b-4889-a715-d9eb2d1925cc" || secret.empty()) {
|
||||||
// 使用默认secret被禁止启动
|
// 使用默认secret被禁止启动
|
||||||
throw std::invalid_argument("please modify the configuration named " + API::kSecret + " in " + g_ini_file);
|
secret = makeRandStr(32, true);
|
||||||
|
mINI::Instance().dumpFile(g_ini_file);
|
||||||
|
WarnL << "The " << API::kSecret << " is invalid, modified it to: " << secret
|
||||||
|
<< ", saved config file: " << g_ini_file;
|
||||||
}
|
}
|
||||||
//rtsp服务器,端口默认554
|
//rtsp服务器,端口默认554
|
||||||
if (rtspPort) { rtspSrv->start<RtspSession>(rtspPort); }
|
if (rtspPort) { rtspSrv->start<RtspSession>(rtspPort); }
|
||||||
|
Loading…
Reference in New Issue
Block a user