-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathgetDefaultContextValues.ts
More file actions
36 lines (32 loc) · 2.24 KB
/
getDefaultContextValues.ts
File metadata and controls
36 lines (32 loc) · 2.24 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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type { ISubscriptionActionContext } from "@microsoft/vscode-azext-utils";
import { relativeSettingsFilePath } from "../../../constants";
import { ext } from "../../../extensionVariables";
import { localize } from "../../../utils/localize";
import type { DeployWorkspaceProjectContext } from "../DeployWorkspaceProjectContext";
import { DeployWorkspaceProjectSettings, getDeployWorkspaceProjectSettings } from "../DeployWorkspaceProjectSettings";
import { getDefaultAcrResources } from "./getDefaultAcrResources";
import { getDefaultContainerAppsResources } from "./getDefaultContainerAppsResources";
import { getWorkspaceProjectPaths } from "./getWorkspaceProjectPaths";
export async function getDefaultContextValues(context: ISubscriptionActionContext): Promise<Partial<DeployWorkspaceProjectContext>> {
const { rootFolder, dockerfilePath } = await getWorkspaceProjectPaths(context);
const settings: DeployWorkspaceProjectSettings | undefined = await getDeployWorkspaceProjectSettings(rootFolder);
if (!settings) {
ext.outputChannel.appendLog(localize('noWorkspaceSettings', 'Scanned and found no matching resource settings at "{0}".', relativeSettingsFilePath));
} else if (!settings.containerAppResourceGroupName || !settings.containerAppName || !settings.containerRegistryName) {
ext.outputChannel.appendLog(localize('resourceSettingsIncomplete', 'Scanned and found incomplete container app resource settings at "{0}".', relativeSettingsFilePath));
}
return {
...await getDefaultContainerAppsResources(context, settings),
...await getDefaultAcrResources(context, settings),
// newRegistrySku: KnownSkuName.Basic,
dockerfilePath,
// environmentVariables: await EnvironmentVariablesListStep.workspaceHasEnvFile() ? undefined : [],
// imageSource: ImageSource.RemoteAcrBuild,
// os: AcrBuildSupportedOS.Linux,
rootFolder,
};
}