Skip to content

Commit

Permalink
Remove Function key by default when publishing (#2938)
Browse files Browse the repository at this point in the history
* Add no-key option to the PublishFunctionAppAction to remove function key from being displayed in the logs

* Removes function keys by default when publishing
  • Loading branch information
michaelpeng36 authored Feb 3, 2022
1 parent d05ecdc commit 5ccbc18
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ internal class PublishFunctionAppAction : BaseFunctionAppAction
public bool ListIgnoredFiles { get; set; }
public bool ListIncludedFiles { get; set; }
public bool RunFromPackageDeploy { get; private set; }
public bool ShowKeys { get; set; }
public bool Force { get; set; }
public bool Csx { get; set; }
public bool BuildNativeDeps { get; set; }
Expand Down Expand Up @@ -95,6 +96,11 @@ public override ICommandLineParserResult ParseArgs(string[] args)
.Setup<bool>("no-bundler")
.WithDescription("[Deprecated] Skips generating a bundle when publishing python function apps with build-native-deps.")
.Callback(nb => ColoredConsole.WriteLine(WarningColor($"Warning: Argument {AdditionalInfoColor("--no-bundler")} is deprecated and a no-op. Python function apps are not bundled anymore.")));
Parser
.Setup<bool>("show-keys")
.WithDescription("Adds function keys to the URLs displayed in the logs.")
.Callback(sk => ShowKeys = sk)
.SetDefault(false);
Parser
.Setup<string>("additional-packages")
.WithDescription("List of packages to install when building native dependencies. For example: \"python3-dev libevent-dev\"")
Expand Down Expand Up @@ -505,7 +511,7 @@ private async Task PublishFunctionApp(Site functionApp, GitIgnoreParser ignorePa
if (!(functionApp.IsLinux && functionApp.IsElasticPremium)
&& !(isFunctionAppDedicatedLinux && PublishBuildOption == BuildOption.Remote))
{
await AzureHelper.PrintFunctionsInfo(functionApp, AccessToken, ManagementURL, showKeys: true);
await AzureHelper.PrintFunctionsInfo(functionApp, AccessToken, ManagementURL, showKeys: ShowKeys);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Azure.Functions.Cli/Helpers/AzureHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public static async Task<HttpResult<Dictionary<string, string>, string>> UpdateF
}

internal static async Task WaitUntilFunctionAppReadyAsync(Site functionApp, string accessToken, string managementURL,
bool showKeys, HttpMessageHandler messageHandler = null)
HttpMessageHandler messageHandler = null)
{
var masterKey = await GetMasterKeyAsync(functionApp.SiteId, accessToken, managementURL);

Expand Down Expand Up @@ -457,7 +457,7 @@ public static async Task PrintFunctionsInfo(Site functionApp, string accessToken
if (functionApp.IsKubeApp)
{
ColoredConsole.Write("Waiting for the functions host up and running ");
await WaitUntilFunctionAppReadyAsync(functionApp, accessToken, managementURL, showKeys);
await WaitUntilFunctionAppReadyAsync(functionApp, accessToken, managementURL);
}

ArmArrayWrapper<FunctionInfo> functions = await GetFunctions(functionApp, accessToken, managementURL);
Expand Down

0 comments on commit 5ccbc18

Please sign in to comment.