@cocalc/project
Version:
CoCalc: project daemon
41 lines • 1.75 kB
JavaScript
;
/*
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
* License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.options = void 0;
// parses command line arguments -- https://github.com/visionmedia/commander.js/
const commander_1 = require("commander");
let options = {
hubPort: 0,
browserPort: 0,
hostname: "127.0.0.1",
testFirewall: false,
kucalc: false,
daemon: false,
sshd: false,
init: "",
};
exports.options = options;
commander_1.program
.name("cocalc-project")
.usage("[?] [options]")
.option("--hub-port <n>", "TCP server port to listen on (default: 0 = random OS assigned); hub connects to this", (n) => parseInt(n), options.hubPort)
.option("--browser-port <n>", "HTTP server port to listen on (default: 0 = random OS assigned); browser clients connect to this", (n) => parseInt(n), options.browserPort)
.option("--hostname [string]", 'hostname of interface to bind to (default: "127.0.0.1")', options.hostname)
.option("--kucalc", "Running in the kucalc environment")
.option("--sshd", "Start the SSH daemon (setup script and configuration must be present)")
.option("--init [string]", "Runs the given script via bash and redirects output to .log and .err files.")
.option("--test-firewall", "Abort and exit w/ code 99 if internal GCE information *is* accessible")
.option("--daemon", "Run as a daemon")
.parse(process.argv);
function init() {
const opts = commander_1.program.opts();
for (const key in opts) {
options[key] = opts[key];
}
return options;
}
exports.default = init;
//# sourceMappingURL=init-program.js.map