|
1 | | -#if !DEBUG |
2 | | -using Azure.Storage.Blobs; |
3 | | -#endif |
| 1 | +using Azure.Storage.Blobs; |
4 | 2 | using Microsoft.AspNetCore.Http; |
5 | 3 | using Microsoft.AspNetCore.Mvc; |
6 | 4 | using Microsoft.Azure.WebJobs; |
7 | 5 | using Microsoft.Azure.WebJobs.Extensions.Http; |
8 | 6 | using Microsoft.Extensions.Logging; |
9 | 7 | using System; |
| 8 | +using System.Diagnostics; |
10 | 9 | using System.IO; |
11 | 10 | using System.Threading.Tasks; |
12 | 11 |
|
@@ -54,18 +53,21 @@ public static async Task<string> GenerateWebpageAsync() |
54 | 53 |
|
55 | 54 | public static async Task<string> GetTemplateFileAsync() |
56 | 55 | { |
57 | | -#if DEBUG |
58 | | - return await File.ReadAllTextAsync("PageGenerator/index.html"); |
59 | | -#else |
60 | | - var connectionString = Environment.GetEnvironmentVariable("AzureWebJobsStorage"); |
| 56 | + if (Debugger.IsAttached) |
| 57 | + { |
| 58 | + return await File.ReadAllTextAsync("PageGenerator/index.html"); |
| 59 | + } |
| 60 | + else |
| 61 | + { |
| 62 | + var connectionString = Environment.GetEnvironmentVariable("AzureWebJobsStorage"); |
61 | 63 |
|
62 | | - // TODO read template location from env/dynamic way |
63 | | - var blobClient = new BlobClient(connectionString, "html-templates", "index.html"); |
| 64 | + // TODO read template location from env/dynamic way |
| 65 | + var blobClient = new BlobClient(connectionString, "html-templates", "index.html"); |
64 | 66 |
|
65 | | - var content = await blobClient.DownloadContentAsync(); |
| 67 | + var content = await blobClient.DownloadContentAsync(); |
66 | 68 |
|
67 | | - return content.Value.Content.ToString(); |
68 | | -#endif |
| 69 | + return content.Value.Content.ToString(); |
| 70 | + } |
69 | 71 | } |
70 | 72 | } |
71 | 73 | } |
0 commit comments