1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 02:09:32 +02:00

Ported CLI from commander to yargs because yargs suits our large CLI better and is easier to develop with. Split commands into separate files since the file was getting annoyingly long.

This commit is contained in:
Simo Kinnunen 2016-12-21 01:09:08 +09:00
parent 72a16ed2ff
commit cc736ba0ac
35 changed files with 2006 additions and 1538 deletions

View file

@ -0,0 +1,43 @@
module.exports.command = 'storage-s3'
module.exports.describe = 'Start an S3 storage unit.'
module.exports.builder = function(yargs) {
return yargs
.env('STF_STORAGE_S3')
.strict()
.option('bucket', {
describe: 'S3 bucket name.'
, type: 'string'
, demand: true
})
.option('endpoint', {
describe: 'S3 bucket endpoint.'
, type: 'string'
, demand: true
})
.option('port', {
alias: 'p'
, describe: 'The port to bind to.'
, type: 'number'
, default: process.env.PORT || 7100
})
.option('profile', {
describe: 'AWS credentials profile name.'
, type: 'string'
, demand: true
})
.epilog('Each option can be be overwritten with an environment variable ' +
'by converting the option to uppercase, replacing dashes with ' +
'underscores and prefixing it with `STF_STORAGE_S3_` (e.g. ' +
'`STF_STORAGE_S3_PROFILE`).')
}
module.exports.handler = function(argv) {
return require('../../units/storage/s3')({
port: argv.port
, profile: argv.profile
, bucket: argv.bucket
, endpoint: argv.endpoint
})
}