Skip to content

Commit 4ae6744

Browse files
committed
do not publish readme and fix apikey nullable warning
1 parent bffb9b0 commit 4ae6744

File tree

5 files changed

+14
-16
lines changed

5 files changed

+14
-16
lines changed

src/AiHedgeFund.Agents/AiHedgeFund.Agents.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
<ItemGroup>
3333
<None Update="README.md">
34-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
34+
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
3535
<Pack>True</Pack>
3636
<PackagePath>\</PackagePath>
3737
</None>

src/AiHedgeFund.Console/Program.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ private static async Task Main(string[] args)
4242

4343
var configuration = BuildConfig();
4444
services.AddHttpClient();
45+
var apiKey = configuration["AlphaVantage:ApiKey"];
46+
if (string.IsNullOrWhiteSpace(apiKey))
47+
throw new InvalidOperationException("AlphaVantage API key is missing in configuration.");
48+
4549
services.AddHttpClient("AlphaVantage", client =>
46-
{
47-
var apiKey = configuration["AlphaVantage:ApiKey"];
48-
if (string.IsNullOrEmpty(apiKey))
49-
throw new InvalidOperationException("AlphaVantage API key is missing in configuration.");
50-
client.BaseAddress = new Uri("https://www.alphavantage.co");
51-
}).AddHttpMessageHandler(() => new AlphaVantageAuthHandler(configuration["AlphaVantage:ApiKey"]));
50+
{
51+
client.BaseAddress = new Uri("https://www.alphavantage.co");
52+
})
53+
.AddHttpMessageHandler(() => new AlphaVantageAuthHandler(apiKey));
5254
services.AddHttpClient("OpenAI", client =>
5355
{
5456
var apiKey = configuration["OpenAI:ApiKey"];

src/AiHedgeFund.Contracts/AiHedgeFund.Contracts.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</PropertyGroup>
2323
<ItemGroup>
2424
<None Update="README.md">
25-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
25+
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
2626
<Pack>True</Pack>
2727
<PackagePath>\</PackagePath>
2828
</None>

src/AiHedgeFund.Data/AiHedgeFund.Data.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
<ItemGroup>
3535
<None Update="README.md">
36-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
36+
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
3737
<Pack>True</Pack>
3838
<PackagePath>\</PackagePath>
3939
</None>

src/AiHedgeFund.Data/AlphaVantage/AlphaVantageAuthHandler.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
namespace AiHedgeFund.Data.AlphaVantage;
22

3-
public class AlphaVantageAuthHandler : DelegatingHandler
3+
public class AlphaVantageAuthHandler(string? apiKey) : DelegatingHandler
44
{
5-
private readonly string _apiKey;
6-
7-
public AlphaVantageAuthHandler(string apiKey)
8-
{
9-
_apiKey = apiKey;
10-
}
5+
private readonly string _apiKey = apiKey
6+
?? throw new ArgumentNullException(nameof(apiKey), "Alpha Vantage API key is required");
117

128
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
139
{

0 commit comments

Comments
 (0)