@x5e/gink
Version:
an eventually consistent database
91 lines • 4.69 kB
JavaScript
;
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.RoutingServerInstance = exports.RoutingServer = 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; } });
var RoutingServer_1 = require("./RoutingServer");
Object.defineProperty(exports, "RoutingServer", { enumerable: true, get: function () { return RoutingServer_1.RoutingServer; } });
var RoutingServerInstance_1 = require("./RoutingServerInstance");
Object.defineProperty(exports, "RoutingServerInstance", { enumerable: true, get: function () { return RoutingServerInstance_1.RoutingServerInstance; } });
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-root", {
help: `path to a directory storing gink database files. this will cause gink to behave as a routing server`,
default: process.env["GINK_DATA_ROOT"],
});
parser.add_argument("--data-file", {
help: `path to a logbacked store 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`,
default: "",
});
parser.add_argument("-r", "--reconnect", {
help: `retry connection to database servers if they disconnect? default is true.`,
nargs: "?",
const: true,
});
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