bln-squrl-tool
Advanced tools
Comparing version 1.1.5 to 2.0.0
@@ -14,4 +14,2 @@ #!/usr/bin/env node | ||
const SessionProvider = require('../../src/stores/op/session'); | ||
const Squrl = require('../../src/squrl'); | ||
@@ -24,3 +22,2 @@ const utils = require('../../src/utils'); | ||
const { | ||
opOption, | ||
awsOption, | ||
@@ -65,3 +62,3 @@ mapOption, | ||
) | ||
.optionX(vaultOption, opOption, awsOption, debugOption, storeOption) | ||
.optionX(vaultOption, awsOption, debugOption, storeOption) | ||
.action( | ||
@@ -116,3 +113,3 @@ errorDebug(async (objPathList, options) => { | ||
) | ||
.optionX(opOption, awsOption, debugOption, storeOptionNoDefault) | ||
.optionX(awsOption, debugOption, storeOptionNoDefault) | ||
.action( | ||
@@ -166,3 +163,3 @@ errorDebug(async (objPathList, options) => { | ||
.option('-d, --descriptive') | ||
.optionX(inputOption, vaultOption, opOption, awsOption, debugOption, storeOption) | ||
.optionX(inputOption, vaultOption, awsOption, debugOption, storeOption) | ||
.action( | ||
@@ -196,3 +193,3 @@ errorDebug(async (hash, argValue, options) => { | ||
.description('create a secret with the value provided and output the reference-key') | ||
.optionX(inputOption, vaultOption, opOption, debugOption, awsOption, storeOption) | ||
.optionX(inputOption, vaultOption, debugOption, awsOption, storeOption) | ||
.action( | ||
@@ -216,3 +213,3 @@ errorDebug(async (argValue, options) => { | ||
.option('-p, --precise', 'prevent output of additional trailing newline character') | ||
.optionX(outputOption, opOption, awsOption, debugOption, storeOptionNoDefault) | ||
.optionX(outputOption, awsOption, debugOption, storeOptionNoDefault) | ||
.action( | ||
@@ -246,3 +243,3 @@ errorDebug(async (referenceKey, options) => { | ||
.description('output hash of value argument or stdin provided') | ||
.optionX(inputOption, vaultOption, opOption, debugOption, storeOption) | ||
.optionX(inputOption, vaultOption, debugOption, storeOption) | ||
.action( | ||
@@ -267,3 +264,3 @@ errorDebug(async (argValue, options) => { | ||
.description('set a secret in a specified file at a particular obj-path from a value') | ||
.optionX(inputOption, vaultOption, opOption, awsOption, debugOption, storeOption) | ||
.optionX(inputOption, vaultOption, awsOption, debugOption, storeOption) | ||
.action( | ||
@@ -288,3 +285,3 @@ errorDebug(async (yamlFile, objPath, argValue, options) => { | ||
.description('get the value of a secret in a specified file at a particular obj-path') | ||
.optionX(outputOption, opOption, awsOption, debugOption, storeOption) | ||
.optionX(outputOption, awsOption, debugOption, storeOption) | ||
.action( | ||
@@ -310,23 +307,4 @@ errorDebug(async (yamlFile, objPath, options) => { | ||
program | ||
.command('get-session') | ||
.description('get a 1Password session, useful for debugging') | ||
.option('-i, --invalidate') | ||
.optionX(opOption, debugOption) | ||
.action( | ||
errorDebug(async (options) => { | ||
Object.assign(options, mapOption(options)); | ||
const sessionProvider = new SessionProvider(mapOption(options)); | ||
const {session} = await sessionProvider.get(Boolean(options.invalidate)); | ||
process.stdout.write(`${session}\n`); | ||
}), | ||
); | ||
program.version(version); | ||
program.description( | ||
'' | ||
+ 'Utility for secret management with bln-cluster-kube and 1Password. ' | ||
+ 'Notes: passwords are not stored, 1Password ' | ||
+ 'sessions have half hour expiry.', | ||
); | ||
program.description('A utility for secret management.'); | ||
@@ -333,0 +311,0 @@ program.parse(process.argv); |
@@ -7,18 +7,2 @@ 'use strict'; | ||
module.exports = { | ||
opOption: (commandObj) => { | ||
commandObj | ||
.option('--opShorthand <shorthand>', '1Password shorthand, use with --opAccount and --opSecretKey') | ||
.option( | ||
'--opAccount <account>', | ||
'1Password account, "<account>.1password.com", use with --opEmail and --opSecretKey, or --opSession', | ||
) | ||
.option('--opEmail <email>', '1Password email, use with --opAccount and --opSecretKey') | ||
.option('--opSecretKey <secret-key>', '1Password secret key, use with --opAccount and --opEmail') | ||
.option('--opPassword <password>', '1Password password, not recommended - often captured in logs') | ||
.option( | ||
'--opSession <session>', | ||
'1Password session, can be used instead of --opEmail, --opSecretKey, use with --opAccount', | ||
); | ||
}, | ||
awsOption: (commandObj) => { | ||
@@ -30,8 +14,2 @@ commandObj.option('--region <region>', 'Specify AWS Secrets Manager region'); | ||
return { | ||
shorthand: options.opShorthand, | ||
account: options.opAccount, | ||
email: options.opEmail, | ||
secretKey: options.opSecretKey, | ||
password: options.opPassword, | ||
session: options.opSession, | ||
region: options.region, | ||
@@ -53,3 +31,3 @@ hashEncodingType: options.store === 'ssm' ? 'base64urlencoded' : 'base64', | ||
`which secret store to use, default is 'aws' ${JSON.stringify(Object.keys(stores))}`, | ||
'op', | ||
'ssm', | ||
); | ||
@@ -66,3 +44,3 @@ }, | ||
vaultOption: (commandObj) => { | ||
commandObj.option('-v, --vault <vault>', `The 1Password vault for the values. Defaults to "${defaults.vault}"`); | ||
commandObj.option('-v, --vault <vault>', `The vault for the values. Defaults to "${defaults.vault}"`); | ||
}, | ||
@@ -69,0 +47,0 @@ |
{ | ||
"name": "bln-squrl-tool", | ||
"version": "1.1.5", | ||
"version": "2.0.0", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "engines": { |
'use strict'; | ||
const AWSSecretsManagerStore = require('./stores/aws'); | ||
const OnePasswordSessionProvider = require('./stores/op/session'); | ||
const OnePasswordSecretStore = require('./stores/op'); | ||
const Squrl = require('./squrl'); | ||
@@ -10,5 +8,3 @@ | ||
AWSSecretsManagerStore, | ||
OnePasswordSecretStore, | ||
OnePasswordSessionProvider, | ||
Squrl, | ||
}; |
@@ -145,3 +145,3 @@ 'use strict'; | ||
describe('passed the same value for an existing key', function () { | ||
it('should set the value in 1Password', async function () { | ||
it('should set the value for the vault', async function () { | ||
AWSMock.mock( | ||
@@ -148,0 +148,0 @@ 'SecretsManager', |
'use strict'; | ||
const aws = require('./aws'); | ||
const op = require('./op'); | ||
const ssm = require('./ssm'); | ||
@@ -10,3 +9,2 @@ | ||
aws, | ||
op, | ||
}; |
@@ -155,3 +155,3 @@ 'use strict'; | ||
describe('passed the same value for an existing key', function () { | ||
it('should set the value in 1Password', async function () { | ||
it('should set the value for the vault', async function () { | ||
AWSMock.mock( | ||
@@ -158,0 +158,0 @@ 'SSM', |
Sorry, the diff of this file is too big to display
6
178538
41
4801