azurite
Version:
An open source Azure Storage API compatible server
106 lines • 4.14 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs_extra_1 = require("fs-extra");
const path_1 = require("path");
const vscode_1 = require("vscode");
class VSCEnvironment {
constructor() {
this.workspaceConfiguration = vscode_1.workspace.getConfiguration("azurite");
}
blobHost() {
return this.workspaceConfiguration.get("blobHost");
}
blobPort() {
return this.workspaceConfiguration.get("blobPort");
}
blobKeepAliveTimeout() {
return this.workspaceConfiguration.get("blobKeepAliveTimeout");
}
queueHost() {
return this.workspaceConfiguration.get("queueHost");
}
queuePort() {
return this.workspaceConfiguration.get("queuePort");
}
queueKeepAliveTimeout() {
return this.workspaceConfiguration.get("queueKeepAliveTimeout");
}
tableHost() {
return this.workspaceConfiguration.get("tableHost");
}
tablePort() {
return this.workspaceConfiguration.get("tablePort");
}
tableKeepAliveTimeout() {
return this.workspaceConfiguration.get("tableKeepAliveTimeout");
}
async location() {
let location = this.workspaceConfiguration.get("location");
// When location configuration is not provided (or is relative), use current opened folder
if (location === undefined || location === "" || !(0, path_1.isAbsolute)(location)) {
if (vscode_1.workspace.workspaceFolders === undefined ||
vscode_1.workspace.workspaceFolders.length === 0) {
// location = join(homedir(), "Azurite");
throw Error(
// tslint:disable-next-line:max-line-length
`Invalid workspace location for Azurite. Please open a folder in Visual Studio Code, or provide a valid workspace folder path for Azurite in Visual Studio Code setting "azurite.location"`);
}
let folder;
if (vscode_1.workspace.workspaceFolders.length > 1) {
folder = await vscode_1.window.showWorkspaceFolderPick({
placeHolder: "Select the working directory you wish to use as Azurite workspace location"
});
if (folder === undefined) {
throw Error(
// tslint:disable-next-line:max-line-length
`Invalid workspace location for Azurite. Please select a folder in Visual Studio Code, or provide a valid workspace folder path for Azurite in Visual Studio Code setting "azurite.location"`);
}
}
else {
folder = vscode_1.workspace.workspaceFolders[0];
}
location = (0, path_1.resolve)(folder.uri.fsPath, location ?? '');
}
await (0, fs_extra_1.ensureDir)(location);
await (0, fs_extra_1.access)(location);
return location;
}
silent() {
return this.workspaceConfiguration.get("silent") || false;
}
loose() {
return this.workspaceConfiguration.get("loose") || false;
}
skipApiVersionCheck() {
return (this.workspaceConfiguration.get("skipApiVersionCheck") || false);
}
async debug() {
return this.workspaceConfiguration.get("debug") || false;
}
cert() {
return this.workspaceConfiguration.get("cert");
}
key() {
return this.workspaceConfiguration.get("key");
}
pwd() {
return this.workspaceConfiguration.get("pwd");
}
oauth() {
return this.workspaceConfiguration.get("oauth");
}
disableProductStyleUrl() {
return (this.workspaceConfiguration.get("disableProductStyleUrl") || false);
}
inMemoryPersistence() {
return this.workspaceConfiguration.get("inMemoryPersistence") || false;
}
extentMemoryLimit() {
return this.workspaceConfiguration.get("extentMemoryLimit");
}
disableTelemetry() {
return (this.workspaceConfiguration.get("disableTelemetry") || false);
}
}
exports.default = VSCEnvironment;
//# sourceMappingURL=VSCEnvironment.js.map