Skip to content

Commit

Permalink
Added support for generic/bot-specific image search keys.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiascibien committed Jul 20, 2019
1 parent 5734e19 commit 7aa9135
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ImageSearch/BingImageSearch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ public class BingImageSearch : ImageSearch

public BingImageSearch(string botPrefix, ImageSearchConfig config) : base(botPrefix, config)
{
var keyEnvVar = $"{BotPrefix}_BING_KEY";
var subscriptionKey = Environment.GetEnvironmentVariable(keyEnvVar);
var subscriptionKey = Environment.GetEnvironmentVariable("BING_KEY") ?? Environment.GetEnvironmentVariable($"{BotPrefix}_BING_KEY");
_client = new ImageSearchClient(new ApiKeyServiceClientCredentials(subscriptionKey));
}

Expand Down

0 comments on commit 7aa9135

Please sign in to comment.