Skip to content

Commit

Permalink
Refactor AppType header (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchitmehta authored Apr 26, 2021
1 parent bec1505 commit 97b2a5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Kudu.Core/K8SE/K8SEDeploymentHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,17 @@ public static string GetAppName(HttpContext context)
return appName;
}

public static string GetAppKind(HttpContext context)
public static string GetAppType(HttpContext context)
{
var appKind = context.Request.Headers["K8SE_APP_KIND"].ToString();
var appType = context.Request.Headers["K8SE_APP_TYPE"].ToString();

if (string.IsNullOrEmpty(appKind))
if (string.IsNullOrEmpty(appType))
{
context.Response.StatusCode = 401;
// K8SE TODO: move this to resource map
throw new InvalidOperationException("Couldn't recognize AppKind");
throw new InvalidOperationException("Couldn't recognize AppType");
}
return appKind;
return appType;
}

public static string GetAppNamespace(HttpContext context)
Expand Down
4 changes: 2 additions & 2 deletions Kudu.Services.Web/KubeMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public async Task Invoke(HttpContext context, IEnvironment environment, IServerC
{
string appName = K8SEDeploymentHelper.GetAppName(context);
string appNamenamespace = K8SEDeploymentHelper.GetAppNamespace(context);
string appKind = K8SEDeploymentHelper.GetAppKind(context);
string appType = K8SEDeploymentHelper.GetAppType(context);

string homeDir = "";
string siteRepoDir = "";
Expand All @@ -59,7 +59,7 @@ public async Task Invoke(HttpContext context, IEnvironment environment, IServerC
}

// Cache the App Environment for this request
context.Items.Add("environment", GetEnvironment(homeDir, appName, null, null, appNamenamespace, appKind));
context.Items.Add("environment", GetEnvironment(homeDir, appName, null, null, appNamenamespace, appType));

// Cache the appName for this request
context.Items.Add("appName", appName);
Expand Down

0 comments on commit 97b2a5b

Please sign in to comment.