Skip to content

Commit

Permalink
chore: Update user agent to include CLI command
Browse files Browse the repository at this point in the history
  • Loading branch information
normj committed Oct 27, 2021
1 parent c4fad95 commit 659d16a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/AWS.Deploy.CLI/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task<int> Run(string[] args)
{
Console.OutputEncoding = Encoding.UTF8;

SetExecutionEnvironment();
SetExecutionEnvironment(args);

_toolInteractiveService.WriteLine("AWS .NET deployment tool for deploying .NET Core applications to AWS.");
_toolInteractiveService.WriteLine("Project Home: https://github.com/aws/aws-dotnet-deploy");
Expand All @@ -45,7 +45,7 @@ public async Task<int> Run(string[] args)
/// Set up the execution environment variable picked up by the AWS .NET SDK. This can be useful for identify calls
/// made by this tool in AWS CloudTrail.
/// </summary>
private static void SetExecutionEnvironment()
private static void SetExecutionEnvironment(string[] args)
{
const string envName = "AWS_EXECUTION_ENV";
const string awsDotnetDeployCLI = "aws-dotnet-deploy-cli";
Expand All @@ -65,6 +65,11 @@ private static void SetExecutionEnvironment()

envValue.Append($"{awsDotnetDeployCLI}_{assemblyVersion?.InformationalVersion}");

if (args?.Length > 0)
{
envValue.Append($"_{args[0]}");
}

Environment.SetEnvironmentVariable(envName, envValue.ToString());
}
}
Expand Down

0 comments on commit 659d16a

Please sign in to comment.