Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Commit 13c1d28

Browse files
committed
fix conflict in config.py
1 parent c52b0a7 commit 13c1d28

File tree

2 files changed

+78
-20
lines changed

2 files changed

+78
-20
lines changed

samples/python-flask/13.core-bot/config.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
# Copyright (c) Microsoft Corporation. All rights reserved.
33
# Licensed under the MIT License.
44

5-
""" Bot Configuration """
5+
import os
6+
67
class DefaultConfig(object):
78
""" Bot Configuration """
89
PORT = 3978
9-
APP_ID = ""
10-
APP_PASSWORD = ""
11-
LUIS_APP_ID = ""
12-
LUIS_API_KEY = ""
10+
APP_ID = os.environ.get("MicrosoftAppId", "")
11+
APP_PASSWORD = os.environ.get("MicrosoftAppPassword", "")
12+
LUIS_APP_ID = os.environ.get("LuisAppId", "")
13+
LUIS_API_KEY = os.environ.get("LuisAPIKey", "")
1314
# LUIS endpoint host name, ie "https://westus.api.cognitive.microsoft.com"
14-
LUIS_API_HOST_NAME = ""
15+
LUIS_API_HOST_NAME = os.environ.get("LuisAPIHostName", "")

samples/python-flask/13.core-bot/deploymentTemplates/exported_template.json

Lines changed: 71 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@
1414
"description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings."
1515
}
1616
},
17-
"newWebAppName": {
17+
"botId": {
1818
"type": "string",
19-
"defaultValue": "",
2019
"metadata": {
21-
"description": "The globally unique name of the Web App. Defaults to the value passed in for \"botId\"."
20+
"description": "The globally unique and immutable bot ID. Also used to configure the displayName of the bot, which is mutable."
21+
}
22+
},
23+
"botSku": {
24+
"defaultValue": "F0",
25+
"type": "string",
26+
"metadata": {
27+
"description": "The pricing tier of the Bot Service Registration. Acceptable values are F0 and S1."
2228
}
2329
},
2430
"newAppServicePlanName": {
@@ -46,35 +52,57 @@
4652
"metadata": {
4753
"description": "The location of the App Service Plan."
4854
}
55+
},
56+
"existingAppServicePlan": {
57+
"type": "string",
58+
"defaultValue": "",
59+
"metadata": {
60+
"description": "Name of the existing App Service Plan used to create the Web App for the bot."
61+
}
62+
},
63+
"newWebAppName": {
64+
"type": "string",
65+
"defaultValue": "",
66+
"metadata": {
67+
"description": "The globally unique name of the Web App. Defaults to the value passed in for \"botId\"."
68+
}
4969
}
5070
},
5171
"variables": {
72+
"defaultAppServicePlanName": "[if(empty(parameters('existingAppServicePlan')), 'createNewAppServicePlan', parameters('existingAppServicePlan'))]",
73+
"useExistingAppServicePlan": "[not(equals(variables('defaultAppServicePlanName'), 'createNewAppServicePlan'))]",
74+
"servicePlanName": "[if(variables('useExistingAppServicePlan'), parameters('existingAppServicePlan'), parameters('newAppServicePlanName'))]",
5275
"publishingUsername": "[concat('$', parameters('newWebAppName'))]",
53-
"resourcesLocation": "[parameters('appServicePlanLocation')]"
76+
"resourcesLocation": "[parameters('appServicePlanLocation')]",
77+
"webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]",
78+
"siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]",
79+
"botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]"
5480
},
5581
"resources": [
5682
{
83+
"comments": "Create a new Linux App Service Plan if no existing App Service Plan name was passed in.",
5784
"type": "Microsoft.Web/serverfarms",
5885
"apiVersion": "2016-09-01",
59-
"name": "[parameters('newAppServicePlanName')]",
86+
"name": "[variables('servicePlanName')]",
6087
"location": "[variables('resourcesLocation')]",
6188
"sku": "[parameters('newAppServicePlanSku')]",
6289
"kind": "linux",
6390
"properties": {
64-
"name": "[parameters('newAppServicePlanName')]",
91+
"name": "[variables('servicePlanName')]",
6592
"perSiteScaling": false,
6693
"reserved": true,
6794
"targetWorkerCount": 0,
6895
"targetWorkerSizeId": 0
6996
}
7097
},
7198
{
99+
"comments": "Create a Web App using a Linux App Service Plan",
72100
"type": "Microsoft.Web/sites",
73101
"apiVersion": "2016-08-01",
74-
"name": "[parameters('newWebAppName')]",
102+
"name": "[variables('webAppName')]",
75103
"location": "[variables('resourcesLocation')]",
76104
"dependsOn": [
77-
"[resourceId('Microsoft.Web/serverfarms', parameters('newAppServicePlanName'))]"
105+
"[resourceId('Microsoft.Web/serverfarms/', variables('servicePlanName'))]"
78106
],
79107
"kind": "app,linux",
80108
"properties": {
@@ -91,7 +119,7 @@
91119
"hostType": "Repository"
92120
}
93121
],
94-
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('newAppServicePlanName'))]",
122+
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('servicePlanName'))]",
95123
"reserved": true,
96124
"scmSiteAlsoStopped": false,
97125
"clientAffinityEnabled": false,
@@ -114,17 +142,23 @@
114142
"name": "SCM_DO_BUILD_DURING_DEPLOYMENT",
115143
"value": "true"
116144
}
117-
]
145+
],
146+
"cors": {
147+
"allowedOrigins": [
148+
"https://botservice.hosting.portal.azure.net",
149+
"https://hosting.onecloud.azure-test.net/"
150+
]
151+
}
118152
}
119153
}
120154
},
121155
{
122156
"type": "Microsoft.Web/sites/config",
123157
"apiVersion": "2016-08-01",
124-
"name": "[concat(parameters('newWebAppName'), '/web')]",
125-
"location": "West US",
158+
"name": "[concat(variables('webAppName'), '/web')]",
159+
"location": "[variables('resourcesLocation')]",
126160
"dependsOn": [
127-
"[resourceId('Microsoft.Web/sites', parameters('newWebAppName'))]"
161+
"[resourceId('Microsoft.Web/sites', variables('webAppName'))]"
128162
],
129163
"properties": {
130164
"numberOfWorkers": 1,
@@ -155,7 +189,7 @@
155189
"use32BitWorkerProcess": true,
156190
"webSocketsEnabled": false,
157191
"alwaysOn": false,
158-
"appCommandLine": "gunicorn --bind=0.0.0.0 --timeout 600 main:app",
192+
"appCommandLine": "",
159193
"managedPipelineMode": "Integrated",
160194
"virtualApplications": [
161195
{
@@ -180,6 +214,29 @@
180214
"ftpsState": "AllAllowed",
181215
"reservedInstanceCount": 0
182216
}
217+
},
218+
{
219+
"apiVersion": "2017-12-01",
220+
"type": "Microsoft.BotService/botServices",
221+
"name": "[parameters('botId')]",
222+
"location": "global",
223+
"kind": "bot",
224+
"sku": {
225+
"name": "[parameters('botSku')]"
226+
},
227+
"properties": {
228+
"name": "[parameters('botId')]",
229+
"displayName": "[parameters('botId')]",
230+
"endpoint": "[variables('botEndpoint')]",
231+
"msaAppId": "[parameters('appId')]",
232+
"developerAppInsightsApplicationId": null,
233+
"developerAppInsightKey": null,
234+
"publishingCredentials": null,
235+
"storageResourceId": null
236+
},
237+
"dependsOn": [
238+
"[resourceId('Microsoft.Web/sites/', variables('webAppName'))]"
239+
]
183240
}
184241
]
185242
}

0 commit comments

Comments
 (0)