@@ -314,8 +314,11 @@ const prepareStaticCdnInputs = async (instance, inputs, origin) => {
314
314
}
315
315
316
316
const prepareInputs = async ( instance , credentials , inputs = { } ) => {
317
- // 对function inputs进行标准化
318
- const tempFunctionConf = inputs . functionConf ? inputs . functionConf : { }
317
+ const tempFunctionConf = inputs . functionConf
318
+ ? inputs . functionConf
319
+ : inputs . functionConfig
320
+ ? inputs . functionConfig
321
+ : { }
319
322
const fromClientRemark = `tencent-${ CONFIGS . compName } `
320
323
const regionList = inputs . region
321
324
? typeof inputs . region == 'string'
@@ -396,32 +399,40 @@ const prepareInputs = async (instance, credentials, inputs = {}) => {
396
399
functionConf . vpcConfig = tempFunctionConf . vpcConfig
397
400
}
398
401
399
- // 对apigw inputs进行标准化
400
- const tempApigwConf = inputs . apigatewayConf ? inputs . apigatewayConf : { }
402
+ const tempApigwConf = inputs . apigatewayConf
403
+ ? inputs . apigatewayConf
404
+ : inputs . apigwConfig
405
+ ? inputs . apigwConfig
406
+ : { }
401
407
const apigatewayConf = Object . assign ( tempApigwConf , {
402
- serviceId : inputs . serviceId ,
408
+ serviceId : inputs . serviceId || tempApigwConf . serviceId ,
403
409
region : regionList ,
404
410
isDisabled : tempApigwConf . isDisabled === true ,
405
411
fromClientRemark : fromClientRemark ,
406
- serviceName : inputs . serviceName || getDefaultServiceName ( instance ) ,
407
- description : getDefaultServiceDescription ( instance ) ,
412
+ serviceName : inputs . serviceName || tempApigwConf . serviceName || getDefaultServiceName ( instance ) ,
413
+ serviceDesc : tempApigwConf . serviceDesc || getDefaultServiceDescription ( instance ) ,
408
414
protocols : tempApigwConf . protocols || [ 'http' ] ,
409
415
environment : tempApigwConf . environment ? tempApigwConf . environment : 'release' ,
410
- endpoints : [
416
+ customDomains : tempApigwConf . customDomains || [ ]
417
+ } )
418
+ if ( ! apigatewayConf . endpoints ) {
419
+ apigatewayConf . endpoints = [
411
420
{
412
- path : '/' ,
421
+ path : tempApigwConf . path || '/' ,
413
422
enableCORS : tempApigwConf . enableCORS ,
414
423
serviceTimeout : tempApigwConf . serviceTimeout ,
415
424
method : 'ANY' ,
425
+ apiName : tempApigwConf . apiName || 'index' ,
416
426
function : {
417
427
isIntegratedResponse : true ,
418
428
functionName : functionConf . name ,
419
- functionNamespace : functionConf . namespace
429
+ functionNamespace : functionConf . namespace ,
430
+ functionQualifier :
431
+ ( tempApigwConf . function && tempApigwConf . function . functionQualifier ) || '$LATEST'
420
432
}
421
433
}
422
- ] ,
423
- customDomains : tempApigwConf . customDomains || [ ]
424
- } )
434
+ ]
435
+ }
425
436
if ( tempApigwConf . usagePlan ) {
426
437
apigatewayConf . endpoints [ 0 ] . usagePlan = {
427
438
usagePlanId : tempApigwConf . usagePlan . usagePlanId ,
0 commit comments