完成http、https修改
This commit is contained in:
@@ -14,10 +14,15 @@ import { log, LogLevel } from './log';
|
||||
* @param config 配置选项
|
||||
*/
|
||||
export const initSwagger = (app: Express, config: Options): void => {
|
||||
// 根据配置生成服务器URL
|
||||
const protocol = config.secure ? 'https' : 'http';
|
||||
const port = config.port || 8080;
|
||||
const serverUrl = `${protocol}://localhost:${port}`;
|
||||
const servers = [
|
||||
{
|
||||
url: serverUrl,
|
||||
description: config.secure ? '本地HTTPS服务器' : '本地HTTP服务器'
|
||||
}
|
||||
];
|
||||
|
||||
/**
|
||||
* Swagger配置选项
|
||||
@@ -34,12 +39,7 @@ export const initSwagger = (app: Express, config: Options): void => {
|
||||
email: 'contact@webrtc.example.com'
|
||||
}
|
||||
},
|
||||
servers: [
|
||||
{
|
||||
url: serverUrl,
|
||||
description: '本地开发服务器'
|
||||
}
|
||||
],
|
||||
servers,
|
||||
components: {
|
||||
securitySchemes: {
|
||||
sessionAuth: {
|
||||
|
||||
Reference in New Issue
Block a user