Skip to content

Commit

Permalink
Support both WEBSITE_USE_ZIP and WEBSITE_RUN_FROM_ZIP (projectkudu#2740)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidebbo authored Apr 16, 2018
1 parent 4de2f70 commit b414cd1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
16 changes: 14 additions & 2 deletions Kudu.Contracts/Settings/DeploymentSettingsExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,28 @@ public static bool DoBuildDuringDeployment(this IDeploymentSettingsManager setti

public static bool RunFromLocalZip(this IDeploymentSettingsManager settings)
{
return settings.GetValue(SettingsKeys.RunFromZip) == "1";
return settings.GetFromFromZipAppSettingValue() == "1";
}

public static bool RunFromRemoteZip(this IDeploymentSettingsManager settings)
{
var value = settings.GetValue(SettingsKeys.RunFromZip);
var value = settings.GetFromFromZipAppSettingValue();

return value != null && value.StartsWith("http", StringComparison.OrdinalIgnoreCase);
}

private static string GetFromFromZipAppSettingValue(this IDeploymentSettingsManager settings)
{
// Try both the old and new app setting names
string runFromZip = settings.GetValue(SettingsKeys.RunFromZip);
if (String.IsNullOrEmpty(runFromZip))
{
runFromZip = settings.GetValue(SettingsKeys.RunFromZipOld);
}

return runFromZip;
}

public static bool RunFromZip(this IDeploymentSettingsManager settings)
=> settings.RunFromLocalZip() || settings.RunFromRemoteZip();
}
Expand Down
3 changes: 2 additions & 1 deletion Kudu.Contracts/Settings/SettingsKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public static class SettingsKeys
public const string DockerCiEnabled = "DOCKER_ENABLE_CI";
public const string LinuxRestartAppContainerAfterDeployment = "SCM_RESTART_APP_CONTAINER_AFTER_DEPLOYMENT";
public const string DoBuildDuringDeployment = "SCM_DO_BUILD_DURING_DEPLOYMENT";
public const string RunFromZip = "WEBSITE_USE_ZIP";
public const string RunFromZipOld = "WEBSITE_USE_ZIP"; // Old name, will eventually go away
public const string RunFromZip = "WEBSITE_RUN_FROM_ZIP";
}
}

0 comments on commit b414cd1

Please sign in to comment.