|
@@ -34,10 +34,14 @@ const main = async() => {
|
|
|
.option('-u, --username <username>', 'Portainer username. Defaults to environment variable PORTAINER_USERNAME.')
|
|
.option('-u, --username <username>', 'Portainer username. Defaults to environment variable PORTAINER_USERNAME.')
|
|
|
.option('-p, --password <password>', 'Portainer password. Defaults to environment variable PORTAINER_PASSWORD.')
|
|
.option('-p, --password <password>', 'Portainer password. Defaults to environment variable PORTAINER_PASSWORD.')
|
|
|
.option('-r, --url <url>', 'Portainer URL, such as http://server:9000. Defaults to environment variable PORTAINER_URL.')
|
|
.option('-r, --url <url>', 'Portainer URL, such as http://server:9000. Defaults to environment variable PORTAINER_URL.')
|
|
|
|
|
+ .option('-k, --insecure', 'Ignore certificate errors.')
|
|
|
.option('-j, --json', 'Format JSON.')
|
|
.option('-j, --json', 'Format JSON.')
|
|
|
const action = handler => async function(model, cb) {
|
|
const action = handler => async function(model, cb) {
|
|
|
try {
|
|
try {
|
|
|
await fillModel(model)
|
|
await fillModel(model)
|
|
|
|
|
+ if (model.options.insecure) {
|
|
|
|
|
+ process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0
|
|
|
|
|
+ }
|
|
|
const client = createClient({
|
|
const client = createClient({
|
|
|
log,
|
|
log,
|
|
|
...model.options
|
|
...model.options
|
|
@@ -86,7 +90,8 @@ const main = async() => {
|
|
|
command('endpoint ls', 'List endpoints')
|
|
command('endpoint ls', 'List endpoints')
|
|
|
.action(action(async (client, model) => await client.getEndpoints()))
|
|
.action(action(async (client, model) => await client.getEndpoints()))
|
|
|
|
|
|
|
|
- await vorpal.parse(process.argv).catch(err => {
|
|
|
|
|
|
|
+ const args = process.argv.length === 2 ? [...process.argv, 'help'] : process.argv
|
|
|
|
|
+ await vorpal.parse(args).catch(err => {
|
|
|
console.error(err)
|
|
console.error(err)
|
|
|
process.exit(1)
|
|
process.exit(1)
|
|
|
})
|
|
})
|