File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 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" />
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 } ) ;
Original file line number Diff line number Diff line change 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}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- <Project Sdk =" Microsoft.NET.Sdk" >
1+ <Project Sdk =" Microsoft.NET.Sdk" >
22
33 <PropertyGroup >
44 <TargetFramework >net6.0</TargetFramework >
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments