Created
March 27, 2019 18:38
-
-
Save guitarrapc/2c556d64e93c1d08f58242313f8c3563 to your computer and use it in GitHub Desktop.
App on Azure or local check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Azure.WebJobs; | |
using System; | |
namespace MyFunction.Extensions | |
{ | |
public static class ExecutionContextExtension | |
{ | |
public static bool IsAzureEnvironment(this ExecutionContext context, string environmentVariable = "WEBSITE_INSTANCE_ID") | |
{ | |
var isAzureEnvironment = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(environmentVariable, EnvironmentVariableTarget.Process)); | |
return isAzureEnvironment; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment