@@ -20,7 +20,24 @@ const pairValidation = input => {
2020 return key && val ;
2121 } ) ;
2222 if ( res . some ( r => ! r ) ) {
23- return `Value should be specified in 'key=val,key2=val2' format!` ;
23+ return `Values should be specified in 'key=val,key2=val2' format!` ;
24+ }
25+ return true ;
26+ } ;
27+
28+ const volumeValidation = input => {
29+ if ( ! input ) {
30+ return true ;
31+ }
32+
33+ const pairs = input . split ( ',' ) ;
34+ const res = pairs . map ( pair => {
35+ const s = pair . split ( ':' ) ;
36+ const [ key , val ] = s ;
37+ return key && val ;
38+ } ) ;
39+ if ( res . some ( r => ! r ) ) {
40+ return `Values should be specified in 'src:dest,src2:dest2' format!` ;
2441 }
2542 return true ;
2643} ;
@@ -112,6 +129,14 @@ exports.handler = async () => {
112129 filter,
113130 validate : pairValidation ,
114131 } ) ;
132+ prompts . push ( {
133+ type : 'input' ,
134+ name : 'volumes' ,
135+ message : 'Volumes [comma-separated, optional]:' ,
136+ default : defaultConfig . volumes ? defaultConfig . volumes . join ( ', ' ) : '' ,
137+ filter,
138+ validate : volumeValidation ,
139+ } ) ;
115140 prompts . push ( {
116141 type : 'confirm' ,
117142 name : 'enableRatelimit' ,
@@ -167,6 +192,7 @@ exports.handler = async () => {
167192 type : 'confirm' ,
168193 name : 'basicAuth' ,
169194 message : 'Add a basic auth user? [optional]:' ,
195+ default : Boolean ( defaultConfig . basicAuth ) ,
170196 } ) ;
171197
172198 // prompts for recursive questions
@@ -209,6 +235,7 @@ exports.handler = async () => {
209235 project,
210236 env,
211237 labels,
238+ volumes,
212239 enableRatelimit,
213240 ratelimitPeriod,
214241 ratelimitAverage,
@@ -247,6 +274,9 @@ exports.handler = async () => {
247274 . map ( pair => ( { key : pair [ 0 ] . trim ( ) , value : pair [ 1 ] . trim ( ) } ) )
248275 . reduce ( ( prev , obj ) => Object . assign ( prev , { [ obj . key ] : obj . value } ) , { } ) ;
249276 }
277+ if ( volumes && volumes . length ) {
278+ config . volumes = volumes . split ( ',' ) . map ( v => v . trim ( ) ) ;
279+ }
250280 if ( enableRatelimit ) {
251281 config . rateLimit = {
252282 period : ratelimitPeriod ,
0 commit comments