Skip to content

Commit 8174d0d

Browse files
authored
Add AzureWebJobsStorage to task dynamically if using emulator (#4703)
* Register debugpy as a python debugProvider * If using local emulator, set the task.json to use azurite connection string
1 parent 2c97ddb commit 8174d0d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/debug/FuncTaskProvider.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { callWithTelemetryAndErrorHandling, type IActionContext } from '@microso
77
import * as process from 'process';
88
import { ShellExecution, Task, TaskScope, workspace, type CancellationToken, type ShellExecutionOptions, type TaskDefinition, type TaskProvider, type WorkspaceFolder } from 'vscode';
99
import { tryGetFunctionProjectRoot } from '../commands/createNewProject/verifyIsProject';
10-
import { ProjectLanguage, buildNativeDeps, extInstallCommand, func, hostStartCommand, packCommand, projectLanguageSetting } from '../constants';
10+
import { ConnectionKey, ProjectLanguage, buildNativeDeps, extInstallCommand, func, hostStartCommand, packCommand, projectLanguageSetting } from '../constants';
11+
import { getLocalSettingsConnectionString } from '../funcConfig/local.settings';
1112
import { getFuncCliPath } from '../funcCoreTools/getFuncCliPath';
1213
import { venvUtils } from '../utils/venvUtils';
1314
import { getFuncWatchProblemMatcher, getWorkspaceSetting } from '../vsCodeConfig/settings';
@@ -120,6 +121,13 @@ export class FuncTaskProvider implements TaskProvider {
120121
options.cwd = projectRoot;
121122
}
122123

124+
const [azureWebJobsStorage, isEmulator] = await getLocalSettingsConnectionString(context, ConnectionKey.Storage, folder.uri.fsPath);
125+
if (azureWebJobsStorage && isEmulator) {
126+
options.env = {
127+
"AzureWebJobsStorage": azureWebJobsStorage
128+
}
129+
}
130+
123131
definition = definition || { type: func, command };
124132
return new Task(definition, folder, command, func, new ShellExecution(commandLine, options), problemMatcher);
125133
}

0 commit comments

Comments
 (0)