Skip to content

Commit 73e9915

Browse files
authored
Fix CONTENT* setting logic for linux premium (#1700)
1 parent 59bf584 commit 73e9915

File tree

4 files changed

+27
-25
lines changed

4 files changed

+27
-25
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@
10291029
"ps-tree": "^1.1.1",
10301030
"request-promise": "^4.2.4",
10311031
"semver": "^5.7.1",
1032-
"vscode-azureappservice": "^0.52.0",
1032+
"vscode-azureappservice": "^0.52.1",
10331033
"vscode-azureextensionui": "^0.28.4",
10341034
"vscode-azurekudu": "^0.1.8",
10351035
"vscode-nls": "^4.1.1",

src/commands/createFunctionApp/FunctionAppCreateStep.ts

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,20 @@ export class FunctionAppCreateStep extends AzureWizardExecuteStep<IFunctionAppWi
113113
});
114114
}
115115

116-
if (context.newSiteOS === WebsiteOS.windows) {
117-
if (runtimeWithoutVersion.toLowerCase() === 'node' && context.version !== FuncVersion.v1) {
118-
// Linux doesn't need this because it uses linuxFxVersion
119-
// v1 doesn't need this because it only supports one version of Node
120-
appSettings.push({
121-
name: 'WEBSITE_NODE_DEFAULT_VERSION',
122-
value: '~' + getRuntimeVersion(runtime)
123-
});
124-
}
116+
if (context.newSiteOS === WebsiteOS.windows && runtimeWithoutVersion.toLowerCase() === 'node' && context.version !== FuncVersion.v1) {
117+
// Linux doesn't need this because it uses linuxFxVersion
118+
// v1 doesn't need this because it only supports one version of Node
119+
appSettings.push({
120+
name: 'WEBSITE_NODE_DEFAULT_VERSION',
121+
value: '~' + getRuntimeVersion(runtime)
122+
});
123+
}
125124

126-
// WEBSITE_CONTENT* settings only apply for Windows https://github.com/Microsoft/vscode-azurefunctions/issues/625
125+
const isElasticPremium: boolean = !!(context.plan && context.plan.sku && context.plan.sku.family && context.plan.sku.family.toLowerCase() === 'ep');
126+
if (context.newSiteOS === WebsiteOS.windows || isElasticPremium) {
127+
// WEBSITE_CONTENT* settings only apply for the following scenarios:
128+
// Windows: https://github.com/Microsoft/vscode-azurefunctions/issues/625
129+
// Linux Elastic Premium: https://github.com/microsoft/vscode-azurefunctions/issues/1682
127130
appSettings.push({
128131
name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING',
129132
value: storageConnectionString
@@ -132,16 +135,16 @@ export class FunctionAppCreateStep extends AzureWizardExecuteStep<IFunctionAppWi
132135
name: 'WEBSITE_CONTENTSHARE',
133136
value: getNewFileShareName(nonNullProp(context, 'newSiteName'))
134137
});
138+
}
135139

136-
// This setting is not required, but we will set it since it has many benefits https://docs.microsoft.com/en-us/azure/azure-functions/run-functions-from-deployment-package
137-
// That being said, it doesn't work on v1 C# Script https://github.com/Microsoft/vscode-azurefunctions/issues/684
138-
// It also doesn't apply for Linux
139-
if (!(context.language === ProjectLanguage.CSharpScript && context.version === FuncVersion.v1)) {
140-
appSettings.push({
141-
name: 'WEBSITE_RUN_FROM_PACKAGE',
142-
value: '1'
143-
});
144-
}
140+
// This setting is not required, but we will set it since it has many benefits https://docs.microsoft.com/en-us/azure/azure-functions/run-functions-from-deployment-package
141+
// That being said, it doesn't work on v1 C# Script https://github.com/Microsoft/vscode-azurefunctions/issues/684
142+
// It also doesn't apply for Linux
143+
if (context.newSiteOS === WebsiteOS.windows && !(context.language === ProjectLanguage.CSharpScript && context.version === FuncVersion.v1)) {
144+
appSettings.push({
145+
name: 'WEBSITE_RUN_FROM_PACKAGE',
146+
value: '1'
147+
});
145148
}
146149

147150
if (context.appInsightsComponent) {

src/tree/SlotTreeItemBase.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ export abstract class SlotTreeItemBase extends AzureParentTreeItem<ISiteTreeRoot
144144
let result: boolean | undefined = this._cachedIsConsumption;
145145
if (result === undefined) {
146146
try {
147-
const asp: WebSiteManagementModels.AppServicePlan | undefined = await this.root.client.getAppServicePlan();
148-
result = !asp || !asp.sku || !asp.sku.tier || asp.sku.tier.toLowerCase() === 'dynamic';
147+
result = await this.root.client.getIsConsumption();
149148
} catch {
150149
// ignore and use default
151150
result = true;

0 commit comments

Comments
 (0)