diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-16 11:21:44 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-16 11:21:44 -0400 |
commit | 9ba06704077c32f84aa4c4aeff8b75e66e1c0486 (patch) | |
tree | 2c977d996bee60ab96faa65e5e7219af23316128 /src/SMAPI.Web/Startup.cs | |
parent | 2dc20be5f711c50cc80de024c8a6afb96c04d8a1 (diff) | |
download | SMAPI-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.cs | 23 |
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, |