Skip to content

Commit

Permalink
To override nested keys through environment variables in shells that …
Browse files Browse the repository at this point in the history
…don’t support : in variable names, replace them with __ (double underscore).
  • Loading branch information
niemyjski committed Jun 8, 2016
1 parent 3124a49 commit 722c000
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -384,15 +384,15 @@ public static void ReadFromAppSettings(this ExceptionlessConfiguration config) {
/// </summary>
/// <param name="config">The configuration object you want to apply the attribute settings to.</param>
public static void ReadFromEnvironmentalVariables(this ExceptionlessConfiguration config) {
string apiKey = GetEnvironmentalVariable("Exceptionless:ApiKey");
string apiKey = GetEnvironmentalVariable("Exceptionless:ApiKey") ?? GetEnvironmentalVariable("Exceptionless__ApiKey");
if (IsValidApiKey(apiKey))
config.ApiKey = apiKey;

bool enabled;
if (Boolean.TryParse(GetEnvironmentalVariable("Exceptionless:Enabled"), out enabled) && !enabled)
if (Boolean.TryParse(GetEnvironmentalVariable("Exceptionless:Enabled") ?? GetEnvironmentalVariable("Exceptionless__Enabled"), out enabled) && !enabled)
config.Enabled = false;

string serverUrl = GetEnvironmentalVariable("Exceptionless:ServerUrl");
string serverUrl = GetEnvironmentalVariable("Exceptionless:ServerUrl") ?? GetEnvironmentalVariable("Exceptionless__ServerUrl");
if (!String.IsNullOrEmpty(serverUrl))
config.ServerUrl = serverUrl;
}
Expand Down

0 comments on commit 722c000

Please sign in to comment.