in src/Amazon.Extensions.Configuration.SystemsManager/AppConfig/AppConfigProcessor.cs [48:80]
public AppConfigProcessor(AppConfigConfigurationSource source)
{
Source = source;
if (source.ApplicationId == null) throw new ArgumentNullException(nameof(source.ApplicationId));
if (source.EnvironmentId == null) throw new ArgumentNullException(nameof(source.EnvironmentId));
if (source.ConfigProfileId == null) throw new ArgumentNullException(nameof(source.ConfigProfileId));
// Check to see if the function is being run inside Lambda. If it is not because it is running in a integ test or in the
// the .NET Lambda Test Tool the Lambda extension is not available and fallback to using the AppConfig service directly.
if(Source.UseLambdaExtension && !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("AWS_LAMBDA_FUNCTION_NAME")))
{
var port = Environment.GetEnvironmentVariable("AWS_APPCONFIG_EXTENSION_HTTP_PORT") ?? "2772";
_lambdaExtensionUri = new Uri($"http://localhost:{port}/applications/{Source.ApplicationId}/environments/{Source.EnvironmentId}/configurations/{Source.ConfigProfileId}");
_lambdaExtensionClient = source.CustomHttpClientForLambdaExtension ?? new HttpClient();
}
else
{
if(source.AwsOptions != null)
{
_appConfigDataClient = source.AwsOptions.CreateServiceClient<IAmazonAppConfigData>();
}
else
{
_appConfigDataClient = new AmazonAppConfigDataClient();
}
if (_appConfigDataClient is AmazonAppConfigDataClient impl)
{
impl.BeforeRequestEvent += ServiceClientAppender.ServiceClientBeforeRequestEvent;
}
}
}