private void ApplicationStarted()

in dotnet/space-translate/SpaceTranslate/WebHook/LogSpaceTranslateRegistrationUrlsTask.cs [35:71]


    private void ApplicationStarted()
    {
        var serverAddresses = _server.Features.Get<IServerAddressesFeature>()?.Addresses.ToList();
        if (serverAddresses == null || serverAddresses.Count == 0)
        {
            _logger.LogInformation("Could not determine server address");
            return;
        }

        var tunnelAddress = _configuration["TunnelAddress"];
        if (!string.IsNullOrEmpty(tunnelAddress))
        {
            serverAddresses.Add(tunnelAddress);
        }

        // Log installation URLs that can be used in Space
        foreach (var serverAddress in serverAddresses)
        {
            var applicationInstallationUri = ApplicationUrlGenerator.GenerateInstallGenericUrl(
                applicationName: Constants.ApplicationName, 
                applicationEndpoint: new Uri(serverAddress + "/space/receive"),
                state: "something-something",
                authFlows: new []
                {
                    SpaceAuthFlow.ClientCredentials(),
                    SpaceAuthFlow.AuthorizationCode(
                        redirectUris: new []
                        {
                            new Uri(serverAddress)
                        },
                        pkceRequired: true),
                },
                authForMessagesFromSpace: AuthForMessagesFromSpace.SigningKey);

            _logger.LogInformation("URL to install the application to Space:\n{Url}", applicationInstallationUri.AbsoluteUri);
        }
    }