Created
September 29, 2012 05:19
-
-
Save SyntaxC4/3803254 to your computer and use it in GitHub Desktop.
Windows Azure Cloud Service or Web Site: Where am I Deployed?
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
switch (process.env.WhereAmI.toLowerCase()) | |
{ | |
case "cloud": | |
//... | |
break; | |
case "websites": | |
//... | |
break; | |
case "local": | |
//... | |
break; | |
} |
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
var appSettings = System.Configuration.ConfigurationManager.AppSettings; | |
var whereAmI = appSettings["WhereAmI"]; | |
switch(whereAmI) | |
{ | |
case "local": | |
goto default; // make local as the default action | |
break; | |
case "websites": | |
//... | |
break; | |
case "cloud": | |
//... | |
break; | |
default: | |
//... | |
} |
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
<?php | |
switch (strtolower(getenv('WhereAmI'))) | |
{ | |
case "cloud": | |
//... | |
break; | |
case "websites": | |
//... | |
break; | |
case "local": | |
//... | |
break; | |
} | |
?> |
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
<ServiceDefinition name="MyService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition"> | |
<WebRole name="WebRole1"> | |
<Runtime> | |
<Environment> | |
<Variable name="WhereAmI" value="cloud" /> | |
</Environment> | |
</Runtime> | |
</WebRole> | |
</ServiceDefinition> |
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
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> | |
<appSettings xdt:Transform="Replace"> | |
<add key="WhereAmI" value"cloud" /> | |
</appSettings> | |
<!-- //... --> | |
</configuration> |
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
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration> | |
<appSettings> | |
<add key="WhereAmI" value"websites" /> | |
</appSettings> | |
<!-- //... --> | |
</configuration> |
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
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> | |
<appSettings xdt:Transform="Replace"> | |
<add key="WhereAmI" value"local" /> | |
</appSettings> | |
<!-- //... --> | |
</configuration> |
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
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> | |
<appSettings xdt:Transform="Replace"> | |
<add key="WhereAmI" value"websites" /> | |
</appSettings> | |
<!-- //... --> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment