UNPKG

@cliz/gpm

Version:
44 lines (43 loc) 1.52 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const cli_1 = require("@cliz/cli"); const client_1 = require("@cliz/inlets/lib/core/client"); const pkg = require('@cliz/inlets/package.json'); exports.default = (0, cli_1.defineSubCommand)((createCommand) => { return createCommand('Share Web Service') .option('-p, --port <port>', 'The port of the web service', { required: true, }) .option('-h, --host <host>', 'The Host', { default: '127.0.0.1', }) .option('--verbose', 'Show Command Log') .action((action) => { const options = action.options; const logger = action.logger; const port = options.port; const host = options.host; const upstream = `${host}:${port}`; logger.info(`share web: http://${upstream}`); const config = { remote: 'inlets.zcorky.com:443', remoteTCPPort: 8443, healthcheckInterval: 30 * 1000, type: 'http', authType: 'public', upstream, token: 'public', version: pkg.version, onError: (error) => { if (error) { logger.error('inlects error:', error); process.exit(1); } }, }; if (typeof process.env.DEBUG !== 'undefined') { logger.info('running config:', config); } return (0, client_1.client)(config); }); });