Skip to content

Commit db87374

Browse files
committed
Don't build unnecessary config object
1 parent 89437a2 commit db87374

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Web/Program.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,14 @@
133133
if (!response.IsSuccessStatusCode)
134134
throw new InvalidOperationException($"Failed to fetch open source data: {response.StatusCode}");
135135

136-
var oss = await JsonSerializer.DeserializeAsync<OpenSource>(response.Content.ReadAsStream(), JsonOptions.Default);
137-
138-
if (oss is null)
139-
throw new InvalidOperationException("Failed to deserialize open source data.");
136+
var oss = await JsonSerializer.DeserializeAsync<OpenSource>(response.Content.ReadAsStream(), JsonOptions.Default)
137+
?? throw new InvalidOperationException("Failed to deserialize open source data.");
140138

141139
return oss;
142140
}));
143141

144142
})
145-
.ConfigureGitHubWebhooks(new ConfigurationBuilder().Configure().Build()["GitHub:Secret"])
143+
.ConfigureGitHubWebhooks(config => config["GitHub:Secret"] ?? throw new ArgumentException("Missing GitHub:Secret configuration"))
146144
.Build();
147145

148146
host.Run();

0 commit comments

Comments
 (0)