Skip to content

Commit

Permalink
Fix up WEBSITE_SITE_NAME is it has underscores. Fixes projectkudu#1390
Browse files Browse the repository at this point in the history
  • Loading branch information
davidebbo committed Nov 14, 2014
1 parent 817b527 commit 69aea50
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 1 addition & 2 deletions Kudu.Core/Deployment/DeploymentStatusFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@ private static string GetOptionalElementValue(XElement element, string localName
private static string GetSiteName(IEnvironment environment)
{
// Try to get the site name from the environment (WAWS will set it)
string siteName = System.Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME");

string siteName = ServerConfiguration.GetApplicationName();
if (String.IsNullOrEmpty(siteName))
{
// Otherwise get it from the root directory name
Expand Down
10 changes: 9 additions & 1 deletion Kudu.Core/Infrastructure/ServerConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,19 @@ public string GitServerRoot
}
}

static private string GetApplicationName()
public static string GetApplicationName()
{
var applicationName = System.Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME");
if(!string.IsNullOrEmpty(applicationName))
{
// Yank everything after the first underscore to work around
// a slot issue where WEBSITE_SITE_NAME gets set incorrectly
int underscoreIndex = applicationName.IndexOf('_');
if (underscoreIndex > 0)
{
applicationName = applicationName.Substring(0, underscoreIndex);
}

return applicationName;
}

Expand Down

0 comments on commit 69aea50

Please sign in to comment.