diff --git a/lib/cli/storage-s3/index.js b/lib/cli/storage-s3/index.js index 13d86245..334a13f0 100644 --- a/lib/cli/storage-s3/index.js +++ b/lib/cli/storage-s3/index.js @@ -1,33 +1,43 @@ -module.exports.command = 'storage-temp' +module.exports.command = 'storage-s3' -module.exports.describe = 'Start a temp storage unit.' +module.exports.describe = 'Start an S3 storage unit.' module.exports.builder = function(yargs) { - var os = require('os') - return yargs - .env('STF_STORAGE_TEMP') + .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('save-dir', { - describe: 'The location where files are saved to.' + .option('profile', { + describe: 'AWS credentials profile name.' , type: 'string' - , default: os.tmpdir() + , 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_TEMP_` (e.g. ' + - '`STF_STORAGE_TEMP_SAVE_DIR`).') + 'underscores and prefixing it with `STF_STORAGE_S3_` (e.g. ' + + '`STF_STORAGE_S3_PROFILE`).') } module.exports.handler = function(argv) { - return require('../../units/storage/temp')({ + return require('../../units/storage/s3')({ port: argv.port - , saveDir: argv.saveDir + , profile: argv.profile + , bucket: argv.bucket + , endpoint: argv.endpoint }) } diff --git a/lib/cli/storage-temp/index.js b/lib/cli/storage-temp/index.js index 334a13f0..13d86245 100644 --- a/lib/cli/storage-temp/index.js +++ b/lib/cli/storage-temp/index.js @@ -1,43 +1,33 @@ -module.exports.command = 'storage-s3' +module.exports.command = 'storage-temp' -module.exports.describe = 'Start an S3 storage unit.' +module.exports.describe = 'Start a temp storage unit.' module.exports.builder = function(yargs) { + var os = require('os') + return yargs - .env('STF_STORAGE_S3') + .env('STF_STORAGE_TEMP') .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.' + .option('save-dir', { + describe: 'The location where files are saved to.' , type: 'string' - , demand: true + , default: os.tmpdir() }) .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`).') + 'underscores and prefixing it with `STF_STORAGE_TEMP_` (e.g. ' + + '`STF_STORAGE_TEMP_SAVE_DIR`).') } module.exports.handler = function(argv) { - return require('../../units/storage/s3')({ + return require('../../units/storage/temp')({ port: argv.port - , profile: argv.profile - , bucket: argv.bucket - , endpoint: argv.endpoint + , saveDir: argv.saveDir }) }