Skip to content

Commit 0e041f3

Browse files
Aymen TROUDIAymen TROUDI
authored andcommitted
Cleanup
1 parent a1d21db commit 0e041f3

8 files changed

Lines changed: 15 additions & 59 deletions

File tree

App/App - Backup.csproj

Lines changed: 0 additions & 34 deletions
This file was deleted.

App/App.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
<ItemGroup>
88
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.33" />
99
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="4.0.1" />
10-
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.2.0" />
11-
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="5.0.1" />
10+
<PackageReference Include="Microsoft.Azure.WebJobs.Host.Storage" Version="4.1.0" />
1211
<PackageReference Include="Microsoft.Azure.WebJobs.Logging.ApplicationInsights" Version="3.0.33" />
1312
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
1413
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="6.0.0" />

App/Functions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class Functions
1313
{
1414
private const string FunctionName = "WebJobDemo";
1515
private const string TimeoutExpression = "00:00:30";
16-
private const string ScheduleExpression = "*/5 * * * * *";
16+
private const string ScheduleExpression = "*/5 * * * *";
1717

1818
private readonly IApiProxy _apiProxy;
1919

App/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
3838
})
3939
.ConfigureServices((hostingContext, services) =>
4040
{
41-
services.Configure<Settings>(hostingContext.Configuration.GetSection("Settings"));
41+
services.Configure<ExternalApi>(hostingContext.Configuration.GetSection("ExternalApi"));
4242
services.AddHttpClient<IApiProxy, ApiProxy>()
4343
.ConfigureHttpClient((provider, client) =>
4444
{
45-
var options = provider.GetRequiredService<IOptions<Settings>>();
46-
var baseAddress = options.Value.ExternalApi.BaseAddress;
45+
var options = provider.GetRequiredService<IOptions<ExternalApi>>();
46+
var baseAddress = options.Value.BaseAddress;
4747
client.BaseAddress = new Uri(baseAddress);
4848
client.DefaultRequestHeaders.Add("Accept", "application/json");
4949
});

App/appsettings.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@
1515
"Default": "Information"
1616
}
1717
},
18-
"Settings": {
19-
"ExternalApi": {
20-
"BaseAddress": "https://api.publicapis.org/",
21-
"QueryString": "/random"
22-
},
23-
"AzureWebJobsStorage": "!PUT YOUR CONNECTION STRING HERE!",
24-
"ApplicationInsights": {
25-
"InstrumentationKey": "!PUT YOUR INSTRUMENTATION KEY HERE!"
26-
}
18+
"ExternalApi": {
19+
"BaseAddress": "https://api.publicapis.org/",
20+
"QueryString": "/random"
21+
},
22+
"AzureWebJobsStorage": "!PUT YOUR CONNECTION STRING HERE!",
23+
"ApplicationInsights": {
24+
"InstrumentationKey": "!PUT YOUR INSTRUMENTATION KEY HERE!"
2725
}
2826
}

Lib/Configuration/Settings.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

Lib/Lib.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>net6.0</TargetFramework>

Lib/Proxies/ApiProxy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ public class ApiProxy : IApiProxy
1414
private readonly HttpClient _client;
1515
private readonly ILogger _logger;
1616

17-
public ApiProxy(HttpClient client, IOptions<Settings> options, ILogger logger)
17+
public ApiProxy(HttpClient client, IOptions<ExternalApi> options, ILogger logger)
1818
{
1919
_client = client ?? throw new ArgumentNullException(nameof(client));
2020
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
21-
_queryString = options.Value.ExternalApi.QueryString;
21+
_queryString = options.Value.QueryString;
2222
_logger.LogInformation("Call to ApiProxy ctor at {now}", DateTime.Now);
2323
}
2424

0 commit comments

Comments
 (0)