Skip to content

Commit

Permalink
feat: move api and web url to vscode configuration (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
meniRoy authored Sep 18, 2023
1 parent 0f6cd05 commit d2fb0f6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
12 changes: 2 additions & 10 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "${defaultBuildTask}",
"env": {
"ENV0_API_URL": "api-dev.dev.env0.com",
"ENV0_WEB_URL": "dev.dev.env0.com"
}
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
Expand All @@ -30,11 +26,7 @@
"${workspaceFolder}/dist/**/*.js"
],
"cwd": "${workspaceFolder}",
"preLaunchTask": "npm: pretest",
"env": {
"ENV0_API_URL": "api-dev.dev.env0.com",
"ENV0_WEB_URL": "dev.dev.env0.com"
}
"preLaunchTask": "npm: pretest"
}
]
}
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@
],
"main": "./dist/extension.js",
"contributes": {
"configuration": {
"title": "env0",
"properties": {
"env0.apiUrl": {
"type": "string",
"default": "api.env0.com"
},
"env0.webUrl": {
"type": "string",
"default": "app.env0.com"
}
}
},
"commands": [
{
"command": "env0.openInEnv0",
Expand Down
8 changes: 6 additions & 2 deletions src/common.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export const ENV0_API_URL = process.env.ENV0_API_URL || "api.env0.com";
export const ENV0_WEB_URL = process.env.ENV0_WEB_URL || "app.env0.com";
import * as vscode from "vscode";

export const ENV0_API_URL =
vscode.workspace.getConfiguration("env0").get("apiUrl") || "api.env0.com";
export const ENV0_WEB_URL =
vscode.workspace.getConfiguration("env0").get("webUrl") || "app.env0.com";
export const ENV0_ENVIRONMENTS_VIEW_ID = "env0-environments";
6 changes: 6 additions & 0 deletions src/test/unit/mocks/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ export const vscode = {
.fn()
.mockImplementation((options: any, task: any) => task()),
},
workspace: {
getConfiguration: () => ({
get: mocker.fn(),
}),
},
};

mock("vscode", vscode);

export const mockLoginCredentialsInput = (keyId: string, secret: string) => {
Expand Down

0 comments on commit d2fb0f6

Please sign in to comment.