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 {
73
73
OnlyRefresh = false ,
74
74
Domain,
75
75
Origin,
76
- ServiceType = 'web' ,
76
+ ServiceType,
77
77
Area = 'mainland' ,
78
78
Https,
79
79
Cache,
@@ -120,7 +120,6 @@ class Cdn {
120
120
const cdnInputs = flushEmptyValue ( {
121
121
Domain,
122
122
Origin : formatOrigin ( Origin ) ,
123
- ServiceType,
124
123
Area,
125
124
Cache,
126
125
IpFilter,
@@ -182,13 +181,18 @@ class Cdn {
182
181
// update
183
182
console . log ( `The CDN domain ${ Domain } has existed.` ) ;
184
183
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
+ }
186
188
await UpdateDomainConfig ( this . capi , cdnInputs ) ;
187
189
outputs . resourceId = cdnInfo . ResourceId ;
188
190
} else {
189
191
// create
190
192
console . log ( `Adding CDN domain ${ Domain } ...` ) ;
191
193
try {
194
+ // if not config ServiceType, default to web
195
+ cdnInputs . ServiceType = ServiceType || 'web' ;
192
196
await AddCdnDomain ( this . capi , cdnInputs ) ;
193
197
} catch ( e ) {
194
198
if ( e . code === 9111 ) {
You can’t perform that action at this time.
0 commit comments