UNPKG

azurite

Version:

An open source Azure Storage API compatible server

114 lines 4.6 kB
"use strict"; /** * This file store table parameter from command line parameters */ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const args_1 = tslib_1.__importDefault(require("args")); const constants_1 = require("./utils/constants"); args_1.default .option(["", "tableHost"], "Optional. Customize listening address for table", constants_1.DEFAULT_TABLE_SERVER_HOST_NAME) .option(["", "tablePort"], "Optional. Customize listening port for table", constants_1.DEFAULT_TABLE_LISTENING_PORT) .option(["", "tableKeepAliveTimeout"], "Optional. Customize http keep alive timeout for table", constants_1.DEFAULT_TABLE_KEEP_ALIVE_TIMEOUT) .option(["l", "location"], "Optional. Use an existing folder as workspace path, default is current working directory", "<cwd>", s => s == "<cwd>" ? undefined : s) .option(["s", "silent"], "Optional. Disable access log displayed in console") .option(["L", "loose"], "Optional. Enable loose mode which ignores unsupported headers and parameters") .option(["", "skipApiVersionCheck"], "Optional. Skip the request API version check, request with all Api versions will be allowed") .option(["", "disableProductStyleUrl"], "Optional. Disable getting account name from the host of request URI, always get account name from the first path segment of request URI.") .option(["", "inMemoryPersistence"], "Optional. Disable persisting any data to disk. If the Azurite process is terminated, all data is lost") .option(["d", "debug"], "Optional. Enable debug log by providing a valid local file path as log destination") .option(["", "oauth"], 'Optional. OAuth level. Candidate values: "basic"') .option(["", "cert"], "Optional. Path to certificate file") .option(["", "key"], "Optional. Path to certificate key .pem file") .option(["", "pwd"], "Optional. Password for .pfx file") .option(["", "disableTelemetry"], "Optional. Disable telemetry data collection of this Azurite execution. By default, Azurite will collect telemetry data to help improve the product."); args_1.default.config.name = "azurite-table"; /** * This class store table configuration from command line parameters * @export * */ class TableEnvironment { constructor() { this.flags = args_1.default.parse(process.argv); } tableHost() { return this.flags.tableHost; } tablePort() { return this.flags.tablePort; } tableKeepAliveTimeout() { return this.flags.tableKeepAvlieTimeout; } async location() { return this.flags.location || process.cwd(); } silent() { if (this.flags.silent !== undefined) { return true; } return false; } loose() { if (this.flags.loose !== undefined) { return true; } // default is false which will block not supported APIs, headers and parameters return false; } skipApiVersionCheck() { if (this.flags.skipApiVersionCheck !== undefined) { return true; } // default is false which will check API version return false; } disableProductStyleUrl() { if (this.flags.disableProductStyleUrl !== undefined) { return true; } // default is false which will try to get account name from request URI hostname return false; } disableTelemetry() { if (this.flags.disableTelemetry !== undefined) { return true; } // default is false which will collect telemetry data return false; } inMemoryPersistence() { if (this.flags.inMemoryPersistence !== undefined) { if (this.flags.location) { throw new RangeError(`The --inMemoryPersistence option is not supported when the --location option is set.`); } return true; } return false; } async debug() { if (typeof this.flags.debug === "string") { // Enable debug log to file return this.flags.debug; } if (this.flags.debug === true) { throw RangeError(`Must provide a debug log file path for parameter -d or --debug`); } // By default disable debug log } oauth() { return this.flags.oauth; } cert() { return this.flags.cert; } key() { return this.flags.key; } pwd() { return this.flags.pwd; } } exports.default = TableEnvironment; //# sourceMappingURL=TableEnvironment.js.map