UNPKG

@holographxyz/cli

Version:
28 lines (27 loc) 1.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HealthCheck = void 0; const core_1 = require("@oclif/core"); const validation_1 = require("../utils/validation"); class HealthCheck extends core_1.Command { static flags = { healthCheck: core_1.Flags.boolean({ description: 'Launch server on http://localhost:6000 to make sure command is still running', default: false, }), healthCheckPort: core_1.Flags.integer({ description: 'This flag allows you to choose what port the health check sever is running on.', dependsOn: ['healthCheck'], }), }; async init() { await super.init(); const { flags } = await this.parse(this.constructor); const enableHealthCheckServer = flags.healthCheck; const healthCheckPort = flags.healthCheckPort || 6000; if (enableHealthCheckServer && !(0, validation_1.portValidator)(healthCheckPort)) { this.error('The port should be in the [3000, 65535] range.'); } } } exports.HealthCheck = HealthCheck;