Skip to content

Commit 40412b4

Browse files
authored
Update Program.cs
Updated to use environment variables to store subscription key and endpoints per standard practice.
1 parent 123bd61 commit 40412b4

File tree

1 file changed

+28
-30
lines changed

1 file changed

+28
-30
lines changed

dotnet/QnAMaker/SDK-based-quickstart/Program.cs

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
/*
2-
* ==========================================
3-
Install QnA Maker package with command
4-
* ==========================================
5-
*
6-
* dotnet add package Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker --version 2.0.1
7-
*
8-
* ==========================================
9-
Tasks Included
10-
* ==========================================
11-
* Create a knowledgebase
12-
* Update a knowledgebase
13-
* Publish a knowledgebase, waiting for publishing to complete
14-
* Get Query runtime endpoint key
15-
* Download a knowledgebase
16-
* Get answer
17-
* Delete a knowledgebase
18-
19-
* ==========================================
20-
Further reading
21-
* General documentation: https://docs.microsoft.com/azure/cognitive-services/QnAMaker
22-
* Reference documentation: https://docs.microsoft.com/en-in/dotnet/api/microsoft.azure.cognitiveservices.knowledge.qnamaker?view=azure-dotnet
23-
* ==========================================
24-
25-
*/
1+
/*
2+
* ==========================================
3+
Install QnA Maker package with command
4+
* ==========================================
5+
*
6+
* dotnet add package Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker --version 2.0.1
7+
*
8+
* ==========================================
9+
Tasks Included
10+
* ==========================================
11+
* Create a knowledgebase
12+
* Update a knowledgebase
13+
* Publish a knowledgebase, waiting for publishing to complete
14+
* Get Query runtime endpoint key
15+
* Download a knowledgebase
16+
* Get answer
17+
* Delete a knowledgebase
18+
19+
* ==========================================
20+
Further reading
21+
* General documentation: https://docs.microsoft.com/azure/cognitive-services/QnAMaker
22+
* Reference documentation: https://docs.microsoft.com/en-in/dotnet/api/microsoft.azure.cognitiveservices.knowledge.qnamaker?view=azure-dotnet
23+
* ==========================================
24+
25+
*/
2626
namespace Knowledgebase_Quickstart
2727
{
2828
// <Dependencies>
@@ -40,11 +40,9 @@ class Program
4040
static void Main(string[] args)
4141
{
4242
// <Resourcevariables>
43-
var authoringKey = "REPLACE-WITH-YOUR-QNA-MAKER-KEY";
44-
var resourceName = "REPLACE-WITH-YOUR-RESOURCE-NAME";
45-
46-
var authoringURL = $"https://{resourceName}.cognitiveservices.azure.com";
47-
var queryingURL = $"https://{resourceName}.azurewebsites.net";
43+
var authoringKey = Environment.GetEnvironmentVariable("QNA_MAKER_SUBSCRIPTION_KEY");
44+
var authoringURL = Environment.GetEnvironmentVariable("QNA_MAKER_ENDPOINT");
45+
var queryingURL = Environment.GetEnvironmentVariable("QNA_MAKER_RUNTIME_ENDPOINT");
4846
// </Resourcevariables>
4947

5048

0 commit comments

Comments
 (0)