summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Startup.cs
diff options
context:
space:
mode:
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,