CDCgov / data-exchange-fhir

Enterprise Data Exchange (DEX) is a new cloud-native centralized data ingestion, validation, and observation service scoped for common data types (HL7, FHIR, CDA, XML, CSV) sent to the CDC. It helps public health stakeholders who send data to the CDC while reducing the maintenance efforts, complexity, and duplication of ingestion points to CDC.
Apache License 2.0
10 stars 2 forks source link

Remove hard-coded paths in Functions to app setting configuration #149

Open briansok71 opened 1 year ago

briansok71 commented 1 year ago

All paths to FHIR service, service bus queues, data lake containers should be configured in Function app settings instead of hard-coded. The functions can read from app settings configuration using environment variables, but prefer dependency injecting IConfiguration (see example below):

Startup.cs

public class Startup : FunctionsStartup
    {
        public override void Configure(IFunctionsHostBuilder builder)
        {
            // DI function configuration
            IConfiguration configuration = new ConfigurationBuilder()
                .AddJsonFile(Constants.Config.LocalSettings, optional: true, reloadOnChange: false)
                .AddEnvironmentVariables()
                .Build();
            builder.Services.AddSingleton<IConfiguration>(configuration);

SomeFunction.cs

public class SomeFunction
    {
        private readonly IConfiguration _configuration;
        private ILogger _logWriter;

        // read DI in constructor
        public SomeFunction(IConfiguration configuration, IHttpClientFactory httpClientFactory)
        {
            _configuration = configuration;
            _healthChecker = new HealthChecker(httpClientFactory);
        }
briansok71 commented 1 year ago

Michael and Nicholas can implement on the 3 Azure Function apps

bennettn4 commented 1 year ago

Values were never hard-coded in the function apps Application configuration was done per Function App in their Configuration In conjunction with the work in CDCgov/data-exchange-fhir#148 configuration has been moved to a single consolidated Azure App Configuration store