File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ class Cdn {
7373 OnlyRefresh = false ,
7474 Domain,
7575 Origin,
76- ServiceType = 'web' ,
76+ ServiceType,
7777 Area = 'mainland' ,
7878 Https,
7979 Cache,
@@ -120,7 +120,6 @@ class Cdn {
120120 const cdnInputs = flushEmptyValue ( {
121121 Domain,
122122 Origin : formatOrigin ( Origin ) ,
123- ServiceType,
124123 Area,
125124 Cache,
126125 IpFilter,
@@ -182,13 +181,18 @@ class Cdn {
182181 // update
183182 console . log ( `The CDN domain ${ Domain } has existed.` ) ;
184183 console . log ( 'Updating...' ) ;
185- // when update, can not set ServiceType parameter
184+ // TODO: when update, VIP user can not set ServiceType parameter, need CDN api optimize
185+ if ( ServiceType && ServiceType !== cdnInfo . ServiceType ) {
186+ cdnInputs . ServiceType = ServiceType ;
187+ }
186188 await UpdateDomainConfig ( this . capi , cdnInputs ) ;
187189 outputs . resourceId = cdnInfo . ResourceId ;
188190 } else {
189191 // create
190192 console . log ( `Adding CDN domain ${ Domain } ...` ) ;
191193 try {
194+ // if not config ServiceType, default to web
195+ cdnInputs . ServiceType = ServiceType || 'web' ;
192196 await AddCdnDomain ( this . capi , cdnInputs ) ;
193197 } catch ( e ) {
194198 if ( e . code === 9111 ) {
You can’t perform that action at this time.
0 commit comments