-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathDeployWorkspaceProjectSettings.ts
More file actions
37 lines (29 loc) · 1.77 KB
/
DeployWorkspaceProjectSettings.ts
File metadata and controls
37 lines (29 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { WorkspaceFolder } from "vscode";
import { settingUtils } from "../../utils/settingUtils";
export interface DeployWorkspaceProjectSettings {
// Container app names are unique to a resource group
containerAppResourceGroupName?: string;
containerAppName?: string;
containerRegistryName?: string;
}
const deployWorkspaceProjectPrefix: string = 'deployWorkspaceProject';
export async function getDeployWorkspaceProjectSettings(rootFolder: WorkspaceFolder): Promise<DeployWorkspaceProjectSettings | undefined> {
const settingsPath: string = settingUtils.getDefaultRootWorkspaceSettingsPath(rootFolder);
try {
const containerAppName: string | undefined = settingUtils.getWorkspaceSetting(`${deployWorkspaceProjectPrefix}.containerAppName`, settingsPath);
const containerAppResourceGroupName: string | undefined = settingUtils.getWorkspaceSetting(`${deployWorkspaceProjectPrefix}.containerAppResourceGroupName`, settingsPath);
const containerRegistryName: string | undefined = settingUtils.getWorkspaceSetting(`${deployWorkspaceProjectPrefix}.containerRegistryName`, settingsPath);
if (containerAppName || containerAppResourceGroupName || containerRegistryName) {
return {
containerAppName,
containerAppResourceGroupName,
containerRegistryName
};
}
} catch { /** Do nothing */ }
return undefined;
}