UNPKG

@x5e/gink

Version:

an eventually consistent database

88 lines 4.2 kB
#!/usr/bin/env node "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CommandLineInterface = exports.SimpleServer = exports.LogBackedStore = void 0; // note, you need to run tsc and run the output __exportStar(require("./index"), exports); var LogBackedStore_1 = require("./LogBackedStore"); Object.defineProperty(exports, "LogBackedStore", { enumerable: true, get: function () { return LogBackedStore_1.LogBackedStore; } }); var SimpleServer_1 = require("./SimpleServer"); Object.defineProperty(exports, "SimpleServer", { enumerable: true, get: function () { return SimpleServer_1.SimpleServer; } }); const CommandLineInterface_1 = require("./CommandLineInterface"); Object.defineProperty(exports, "CommandLineInterface", { enumerable: true, get: function () { return CommandLineInterface_1.CommandLineInterface; } }); const argparse_1 = require("argparse"); // Run the CLI if run as a script. if (require.main === module) { const parser = new argparse_1.ArgumentParser(); parser.add_argument("-c", "--connect-to", { help: `gink databases to connect to (e.g wss://localhost:8080)`, nargs: "*", }); parser.add_argument("-l", "--listen-on", { help: `port to listen on (default 8080). if flag is not included, gink does not listen for incoming connections.`, default: process.env["GINK_PORT"], nargs: "?", const: 8080, }); parser.add_argument("data_file", { nargs: "?", help: `path to a log-backed database file.`, default: process.env["GINK_DATA_FILE"], }); parser.add_argument("-i", "--identity", { help: `explicitly set your identity. default is user@hostname.`, }); parser.add_argument("--static-path", { help: `the path to serve static files from. if you change this, you won't be able to access the gink dashboard.`, default: process.env["GINK_STATIC_PATH"], }); parser.add_argument("--auth-token", { help: `if gink is listening for connections, this is the token required for clients to connect. if gink is connecting to other databases, this token will be passed.`, default: process.env["GINK_AUTH_TOKEN"], }); parser.add_argument("--ssl-cert", { help: `path to an ssl certificate. if this and --ssl-key are provided and valid, gink will listen using wss:// for secure connections.`, default: process.env["GINK_SSL_CERT"], }); parser.add_argument("--ssl-key", { help: `path to an ssl key. if this and --ssl-cert are provided and valid, gink will listen using wss:// for secure connections.`, default: process.env["GINK_SSL_KEY"], }); parser.add_argument("-v", "--verbose", { help: `whether or not to be verbose`, action: "store_true", }); parser.add_argument("--exclusive", { help: `prevent other programs from accessing this file (faster)`, action: "store_true", }); parser.add_argument("-r", "--reconnect", { help: `retry connection to database servers if they disconnect? default is false.`, nargs: "?", const: false, }); const args = parser.parse_args(); new CommandLineInterface_1.CommandLineInterface(args).run(); } process.on("unhandledRejection", (reason, promise) => { if (reason) throw new Error(reason); else console.log("Unhandled Promise Rejection: Likely due to closed websocket connection."); }); //# sourceMappingURL=main.js.map