-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPollFreshDeskTicket_Http.cs
More file actions
46 lines (38 loc) · 1.55 KB
/
PollFreshDeskTicket_Http.cs
File metadata and controls
46 lines (38 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration;
using BotFramework.FreshDeskChannel.Shared;
using System;
namespace BotFramework.FreshDeskChannel
{
public static class PollFreshDeskTicket_Http
{
[FunctionName("PollFreshDeskTicket_Http")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
ExecutionContext context,
ILogger log)
{
try
{
//Read config values
var config = new ConfigurationBuilder()
.SetBasePath(context.FunctionAppDirectory)
.AddJsonFile("local.settings.json", optional: true, reloadOnChange: true) // <- This gives you access to your application settings in your local development environment
.AddEnvironmentVariables() // <- This is what actually gets you the application settings in Azure
.Build();
await CustomChannelLogic.ProcessChannel(config, log);
return new OkObjectResult("Ok");
}
catch (Exception ex)
{
log.LogError("Exception occurred in processing Azure Function: {1}", ex);
return new StatusCodeResult(500);
}
}
}
}