summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Startup.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-16 11:21:44 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-16 11:21:44 -0400
commit9ba06704077c32f84aa4c4aeff8b75e66e1c0486 (patch)
tree2c977d996bee60ab96faa65e5e7219af23316128 /src/SMAPI.Web/Startup.cs
parent2dc20be5f711c50cc80de024c8a6afb96c04d8a1 (diff)
downloadSMAPI-9ba06704077c32f84aa4c4aeff8b75e66e1c0486.tar.gz
SMAPI-9ba06704077c32f84aa4c4aeff8b75e66e1c0486.tar.bz2
SMAPI-9ba06704077c32f84aa4c4aeff8b75e66e1c0486.zip
fix Nexus API key needed to launch web project locally
Diffstat (limited to 'src/SMAPI.Web/Startup.cs')
-rw-r--r--src/SMAPI.Web/Startup.cs23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/SMAPI.Web/Startup.cs b/src/SMAPI.Web/Startup.cs
index 98dbca5e..2693aa90 100644
--- a/src/SMAPI.Web/Startup.cs
+++ b/src/SMAPI.Web/Startup.cs
@@ -128,14 +128,21 @@ namespace StardewModdingAPI.Web
modUrlFormat: api.ModDropModPageUrl
));
- services.AddSingleton<INexusClient>(new NexusClient(
- webUserAgent: userAgent,
- webBaseUrl: api.NexusBaseUrl,
- webModUrlFormat: api.NexusModUrlFormat,
- webModScrapeUrlFormat: api.NexusModScrapeUrlFormat,
- apiAppVersion: version,
- apiKey: api.NexusApiKey
- ));
+ if (!string.IsNullOrWhiteSpace(api.NexusApiKey))
+ {
+ services.AddSingleton<INexusClient>(new NexusClient(
+ webUserAgent: userAgent,
+ webBaseUrl: api.NexusBaseUrl,
+ webModUrlFormat: api.NexusModUrlFormat,
+ webModScrapeUrlFormat: api.NexusModScrapeUrlFormat,
+ apiAppVersion: version,
+ apiKey: api.NexusApiKey
+ ));
+ }
+ else
+ {
+ services.AddSingleton<INexusClient>(new DisabledNexusClient());
+ }
services.AddSingleton<IPastebinClient>(new PastebinClient(
baseUrl: api.PastebinBaseUrl,