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

Commit 4c6a8a5

Browse files
authored
Merge branch 'master' into add-date-time-prompt-test
2 parents 6d9eead + 9c7322b commit 4c6a8a5

File tree

2 files changed

+249
-5
lines changed

2 files changed

+249
-5
lines changed

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

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

5+
import os
6+
57
""" Bot Configuration """
68
class DefaultConfig(object):
79
""" Bot Configuration """
810
PORT = 3978
9-
APP_ID = ""
10-
APP_PASSWORD = ""
11-
LUIS_APP_ID = ""
12-
LUIS_API_KEY = ""
11+
APP_ID = os.environ.get("MicrosoftAppId", "")
12+
APP_PASSWORD = os.environ.get("MicrosoftAppPassword", "")
13+
LUIS_APP_ID = os.environ.get("LuisAppId", "")
14+
LUIS_API_KEY = os.environ.get("LuisAPIKey", "")
1315
# LUIS endpoint host name, ie "https://westus.api.cognitive.microsoft.com"
14-
LUIS_API_HOST_NAME = ""
16+
LUIS_API_HOST_NAME = os.environ.get("LuisAPIHostName", "")
Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"appId": {
6+
"type": "string",
7+
"metadata": {
8+
"description": "Active Directory App ID, set as MicrosoftAppId in the Web App's Application Settings."
9+
}
10+
},
11+
"appSecret": {
12+
"type": "string",
13+
"metadata": {
14+
"description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings."
15+
}
16+
},
17+
"botId": {
18+
"type": "string",
19+
"metadata": {
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."
28+
}
29+
},
30+
"newAppServicePlanName": {
31+
"type": "string",
32+
"defaultValue": "",
33+
"metadata": {
34+
"description": "The name of the new App Service Plan."
35+
}
36+
},
37+
"newAppServicePlanSku": {
38+
"type": "object",
39+
"defaultValue": {
40+
"name": "S1",
41+
"tier": "Standard",
42+
"size": "S1",
43+
"family": "S",
44+
"capacity": 1
45+
},
46+
"metadata": {
47+
"description": "The SKU of the App Service Plan. Defaults to Standard values."
48+
}
49+
},
50+
"appServicePlanLocation": {
51+
"type": "string",
52+
"metadata": {
53+
"description": "The location of the App Service Plan."
54+
}
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+
}
69+
}
70+
},
71+
"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'))]",
75+
"publishingUsername": "[concat('$', parameters('newWebAppName'))]",
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')]"
80+
},
81+
"resources": [
82+
{
83+
"comments": "Create a new Linux App Service Plan if no existing App Service Plan name was passed in.",
84+
"type": "Microsoft.Web/serverfarms",
85+
"apiVersion": "2016-09-01",
86+
"name": "[variables('servicePlanName')]",
87+
"location": "[variables('resourcesLocation')]",
88+
"sku": "[parameters('newAppServicePlanSku')]",
89+
"kind": "linux",
90+
"properties": {
91+
"name": "[variables('servicePlanName')]",
92+
"perSiteScaling": false,
93+
"reserved": true,
94+
"targetWorkerCount": 0,
95+
"targetWorkerSizeId": 0
96+
}
97+
},
98+
{
99+
"comments": "Create a Web App using a Linux App Service Plan",
100+
"type": "Microsoft.Web/sites",
101+
"apiVersion": "2016-08-01",
102+
"name": "[variables('webAppName')]",
103+
"location": "[variables('resourcesLocation')]",
104+
"dependsOn": [
105+
"[resourceId('Microsoft.Web/serverfarms/', variables('servicePlanName'))]"
106+
],
107+
"kind": "app,linux",
108+
"properties": {
109+
"enabled": true,
110+
"hostNameSslStates": [
111+
{
112+
"name": "[concat(parameters('newWebAppName'), '.azurewebsites.net')]",
113+
"sslState": "Disabled",
114+
"hostType": "Standard"
115+
},
116+
{
117+
"name": "[concat(parameters('newWebAppName'), '.scm.azurewebsites.net')]",
118+
"sslState": "Disabled",
119+
"hostType": "Repository"
120+
}
121+
],
122+
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('servicePlanName'))]",
123+
"reserved": true,
124+
"scmSiteAlsoStopped": false,
125+
"clientAffinityEnabled": false,
126+
"clientCertEnabled": false,
127+
"hostNamesDisabled": false,
128+
"containerSize": 0,
129+
"dailyMemoryTimeQuota": 0,
130+
"httpsOnly": false,
131+
"siteConfig": {
132+
"appSettings": [
133+
{
134+
"name": "MicrosoftAppId",
135+
"value": "[parameters('appId')]"
136+
},
137+
{
138+
"name": "MicrosoftAppPassword",
139+
"value": "[parameters('appSecret')]"
140+
},
141+
{
142+
"name": "SCM_DO_BUILD_DURING_DEPLOYMENT",
143+
"value": "true"
144+
}
145+
],
146+
"cors": {
147+
"allowedOrigins": [
148+
"https://botservice.hosting.portal.azure.net",
149+
"https://hosting.onecloud.azure-test.net/"
150+
]
151+
}
152+
}
153+
}
154+
},
155+
{
156+
"type": "Microsoft.Web/sites/config",
157+
"apiVersion": "2016-08-01",
158+
"name": "[concat(variables('webAppName'), '/web')]",
159+
"location": "[variables('resourcesLocation')]",
160+
"dependsOn": [
161+
"[resourceId('Microsoft.Web/sites', variables('webAppName'))]"
162+
],
163+
"properties": {
164+
"numberOfWorkers": 1,
165+
"defaultDocuments": [
166+
"Default.htm",
167+
"Default.html",
168+
"Default.asp",
169+
"index.htm",
170+
"index.html",
171+
"iisstart.htm",
172+
"default.aspx",
173+
"index.php",
174+
"hostingstart.html"
175+
],
176+
"netFrameworkVersion": "v4.0",
177+
"phpVersion": "",
178+
"pythonVersion": "",
179+
"nodeVersion": "",
180+
"linuxFxVersion": "PYTHON|3.7",
181+
"requestTracingEnabled": false,
182+
"remoteDebuggingEnabled": false,
183+
"remoteDebuggingVersion": "VS2017",
184+
"httpLoggingEnabled": true,
185+
"logsDirectorySizeLimit": 35,
186+
"detailedErrorLoggingEnabled": false,
187+
"publishingUsername": "[variables('publishingUsername')]",
188+
"scmType": "None",
189+
"use32BitWorkerProcess": true,
190+
"webSocketsEnabled": false,
191+
"alwaysOn": false,
192+
"appCommandLine": "",
193+
"managedPipelineMode": "Integrated",
194+
"virtualApplications": [
195+
{
196+
"virtualPath": "/",
197+
"physicalPath": "site\\wwwroot",
198+
"preloadEnabled": false,
199+
"virtualDirectories": null
200+
}
201+
],
202+
"winAuthAdminState": 0,
203+
"winAuthTenantState": 0,
204+
"customAppPoolIdentityAdminState": false,
205+
"customAppPoolIdentityTenantState": false,
206+
"loadBalancing": "LeastRequests",
207+
"routingRules": [],
208+
"experiments": {
209+
"rampUpRules": []
210+
},
211+
"autoHealEnabled": false,
212+
"vnetName": "",
213+
"minTlsVersion": "1.2",
214+
"ftpsState": "AllAllowed",
215+
"reservedInstanceCount": 0
216+
}
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+
]
240+
}
241+
]
242+
}

0 commit comments

Comments
 (0)