Skip to content

Commit c6dc7d8

Browse files
authored
Hide documentation banner for configuring Lambda functions when tool is hosted by Aspire (#1951)
1 parent 5dceeb2 commit c6dc7d8

File tree

2 files changed

+18
-6
lines changed
  • Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool

2 files changed

+18
-6
lines changed

Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Components/Pages/Home.razor

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@using Amazon.Lambda.TestTool.Models
44
@using Amazon.Lambda.TestTool.SampleRequests
55
@using Amazon.Lambda.TestTool.Services
6+
@using Amazon.Lambda.TestTool.Utilities
67

78
<PageTitle>Lambda Function Tester</PageTitle>
89

@@ -26,11 +27,14 @@
2627
</div>
2728
</div>
2829

29-
<div class="alert alert-secondary" role="alert">
30-
For Lambda functions written as executable assemblies, i.e. custom runtimes functions and top level statement functions, this page can be used for testing the functions locally.
31-
Set the <b>AWS_LAMBDA_RUNTIME_API</b> environment variable to <b>@HttpContextAccessor.HttpContext?.Request.Host</b> while debugging executable assembly
32-
Lambda function. More information can be found in the <a href="/documentation">documentation</a>.
33-
</div>
30+
@if (!Utils.IsAspireHosted)
31+
{
32+
<div class="alert alert-secondary" role="alert">
33+
For Lambda functions written as executable assemblies, i.e. custom runtimes functions and top level statement functions, this page can be used for testing the functions locally.
34+
Set the <b>AWS_LAMBDA_RUNTIME_API</b> environment variable to <b>@HttpContextAccessor.HttpContext?.Request.Host</b> while debugging executable assembly
35+
Lambda function. More information can be found in the <a href="/documentation">documentation</a>.
36+
</div>
37+
}
3438

3539
@if (DataStore == null)
3640
{

Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Utilities/Utils.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

44
using System.Reflection;
@@ -42,6 +42,14 @@ public static string DetermineToolVersion()
4242
return version ?? unknownVersion;
4343
}
4444

45+
/// <summary>
46+
/// If true it means the test tool was launched via an Aspire AppHost.
47+
/// </summary>
48+
internal static bool IsAspireHosted
49+
{
50+
get { return string.Equals(Environment.GetEnvironmentVariable("ASPIRE_HOSTED"), "true", StringComparison.OrdinalIgnoreCase); }
51+
}
52+
4553
/// <summary>
4654
/// Attempt to pretty print the input string. If pretty print fails return back the input string in its original form.
4755
/// </summary>

0 commit comments

Comments
 (0)