Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,15 @@ export class EnvironmentVariablesListStep extends AzureWizardPromptStep<Environm

private async selectEnvironmentSettings(context: EnvironmentVariablesContext): Promise<DotenvParseOutput | undefined> {
const placeHolder: string = localize('setEnvVar', 'Select a {0} file to set the environment variables for the container instance', '.env');
// since we only allow one container, we can assume that we want the first container's env settings
const existingData: DotenvParseOutput | undefined = context.containerApp?.template?.containers?.[0].env as DotenvParseOutput | undefined;
Comment thread
MicroFish91 marked this conversation as resolved.
const skipLabel: string | undefined = existingData ? localize('useExisting', 'Use existing configuration') : undefined;

const envFileFsPath: string | undefined = await selectWorkspaceFile(context, placeHolder,
{ filters: { 'env file': ['env', 'env.*'] }, allowSkip: true }, allEnvFilesGlobPattern);
{ filters: { 'env file': ['env', 'env.*'] }, allowSkip: true, skipLabel }, allEnvFilesGlobPattern);

if (!envFileFsPath) {
return undefined;
return existingData;
}

const data = await AzExtFsExtra.readFile(envFileFsPath);
Expand Down
7 changes: 6 additions & 1 deletion src/utils/workspaceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ interface SelectWorkspaceFileOptions extends OpenDialogOptions {
* Include a 'skipForNow` option in the prompting. Selection of `skipForNow` should correspond to a value of `undefined`
*/
allowSkip?: boolean;
/**
* Optional label for the 'skipForNow' option; will default to 'Skip for now' if not provided
*/
skipLabel?: string;
/**
* If searching through the workspace file path returns only one matching result, automatically return its path without additional prompting
*/
Expand Down Expand Up @@ -68,9 +72,10 @@ export async function selectWorkspaceFile(

quickPicks.push(browseItem);

const label = options.skipLabel ?? localize('skipForNow', '$(clock) Skip for now');
if (options.allowSkip) {
quickPicks.push({
label: localize('skipForNow', '$(clock) Skip for now'),
label,
description: '',
data: skipForNow
});
Expand Down