Skip to content

Commit ef0e971

Browse files
committed
Allow setting image and image tar file in config
1 parent 43c9302 commit ef0e971

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

src/commands/config.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,37 @@ exports.handler = async () => {
188188
default: defaultConfig.template,
189189
filter,
190190
});
191+
// docker image deployment part
192+
prompts.push({
193+
type: 'confirm',
194+
name: 'deployWithImage',
195+
message: 'Deploy using docker image? [optional]:',
196+
default: Boolean(defaultConfig.image),
197+
});
198+
prompts.push({
199+
type: 'input',
200+
name: 'image',
201+
message: 'Deploy using docker image:',
202+
default: defaultConfig.image || '',
203+
filter,
204+
when: ({deployWithImage}) => deployWithImage,
205+
});
206+
prompts.push({
207+
type: 'input',
208+
name: 'imageFile',
209+
message: 'Load docker image from tar file [optional]:',
210+
default: defaultConfig.imageFile || '',
211+
filter,
212+
when: ({deployWithImage}) => deployWithImage,
213+
});
214+
215+
// basic auth part
191216
prompts.push({
192217
type: 'confirm',
193218
name: 'basicAuth',
194219
message: 'Add a basic auth user? [optional]:',
195220
default: Boolean(defaultConfig.basicAuth),
196221
});
197-
198222
// prompts for recursive questions
199223
const recursivePrompts = [];
200224
recursivePrompts.push({
@@ -243,6 +267,8 @@ exports.handler = async () => {
243267
hostname,
244268
restart,
245269
template,
270+
image,
271+
imageFile,
246272
basicAuth,
247273
} = await inquirer.prompt(prompts);
248274

@@ -290,6 +316,12 @@ exports.handler = async () => {
290316
if (template && template.length) {
291317
config.template = template;
292318
}
319+
if (image && image.length) {
320+
config.image = image;
321+
}
322+
if (imageFile && imageFile.length) {
323+
config.imageFile = imageFile;
324+
}
293325
if (users.length !== 0) {
294326
config.basicAuth = users.reduce((acc, curr, index) => {
295327
const delimeter = users.length - 1 === index ? '' : ',';

0 commit comments

Comments
 (0)