import { AzureWizardExecuteStep , IStorageAccountWizardContext } from 'vscode-azureextensionui' ; import { localEmulatorConnectionString } from '../../constants' ; import { azureWebJobsStorageKey , MismatchBehavior , setLocalAppSetting } from '../../funcConfig/local.settings' ; import { getStorageConnectionString } from '../../utils/azure' ; import { IAzureWebJobsStorageWizardContext } from './IAzureWebJobsStorageWizardContext' ; export class AzureWebJobsStorageExecuteStep < T extends IAzureWebJobsStorageWizardContext > extends AzureWizardExecuteStep < T > { public priority : number = 230 ; public async execute ( context ) { let value ; if ( context . azureWebJobsStorageType === 'emulator' ) { value = localEmulatorConnectionString ; } else { value = ( await getStorageConnectionString ( < IStorageAccountWizardContext > context ) ) . connectionString ; } await setLocalAppSetting ( context , context . projectPath , azureWebJobsStorageKey , value , MismatchBehavior . Overwrite ) ; } public shouldExecute ( context ) { return ! ! context . azureWebJobsStorageType ; } }