private async getAppSettings()

in apps/vs-code-designer/src/app/commands/createLogicApp/createLogicAppSteps/LogicAppCreateStep.ts [117:216]


  private async getAppSettings(context: ILogicAppWizardContext): Promise<NameValuePair[]> {
    const runtime: string = nonNullProp(context, 'newSiteRuntime');
    const runtimeWithoutVersion: string = getRuntimeWithoutVersion(runtime);

    const storageConnectionString: ConnectionStrings = await getStorageConnectionStrings(context);

    const appSettings: NameValuePair[] = [
      {
        name: extensionVersionKey,
        value: `~${tryGetMajorVersion(context.version)}`,
      },
      {
        name: appKindSetting,
        value: logicAppKindAppSetting,
      },
      {
        name: workerRuntimeKey,
        value: runtimeWithoutVersion,
      },
      {
        name: webhookRedirectHostUri,
        value: '',
      },
    ];

    if (context.storageType === StorageOptions.SQL) {
      appSettings.push(
        {
          name: sqlStorageConnectionStringKey,
          value: storageConnectionString.sqlConnectionStringValue,
        },
        {
          name: azureWebJobsStorageKey,
          value: storageConnectionString.azureWebJobsStorageKeyValue,
        }
      );
    } else {
      appSettings.push({
        name: azureWebJobsStorageKey,
        value: storageConnectionString.azureWebJobsStorageKeyValue,
      });
    }

    if (context.customLocation) {
      appSettings.push(
        {
          name: 'AzureFunctionsJobHost__extensionBundle__id',
          value: extensionBundleId,
        },
        {
          name: 'AzureFunctionsJobHost__extensionBundle__version',
          value: defaultVersionRange,
        }
      );
    }

    if (context.version === FuncVersion.v1) {
      appSettings.push({
        name: 'AzureWebJobsDashboard',
        value: storageConnectionString.azureWebJobsDashboardValue,
      });
    }

    if (
      context.newSiteOS === WebsiteOS.windows &&
      runtimeWithoutVersion.toLowerCase() === WorkerRuntime.Node &&
      context.version !== FuncVersion.v1
    ) {
      // Linux doesn't need this because it uses linuxFxVersion
      // v1 doesn't need this because it only supports one version of Node
      appSettings.push({
        name: 'WEBSITE_NODE_DEFAULT_VERSION',
        value: `~${getRuntimeVersion(runtime)}`,
      });
    }

    const isWorkflowStandard: boolean = context.plan?.sku?.family?.toLowerCase() === 'ws';
    if (context.newSiteOS === WebsiteOS.windows || isWorkflowStandard) {
      // WEBSITE_CONTENT* settings only apply for the following scenarios:
      // Windows: https://github.com/Microsoft/vscode-azurefunctions/issues/625
      // Linux Elastic Premium: https://github.com/microsoft/vscode-azurefunctions/issues/1682
      appSettings.push({
        name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING',
        value: storageConnectionString.websiteContentAzureFileValue,
      });
      appSettings.push({
        name: 'WEBSITE_CONTENTSHARE',
        value: getNewFileShareName(nonNullProp(context, 'newSiteName')),
      });
    }

    if (context.appInsightsComponent) {
      appSettings.push({
        name: 'APPINSIGHTS_INSTRUMENTATIONKEY',
        value: context.appInsightsComponent.instrumentationKey,
      });
    }

    return appSettings;
  }