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