Skip to content

Working with configuration

COPA-DATA Product Management edited this page Oct 16, 2019 · 7 revisions

To configure a driver extension, configuration files are used. These files must be located in the Files\Driver area of the project

It is important to define the configuration file name in the corresponding GenericNet's assembly settings.

public Task InitializeAsync(ILogger logger, IValueCallback valueCallback, string configFilePath)
{
  _logger = logger;
  _valueCallback = valueCallback;

  var configurationBuilder = new ConfigurationBuilder()
      .AddJsonFile(configFilePath, optional: true);
  var configuration = configurationBuilder.Build();
  var serverAddress = configuration["MqttServerAddress"] ?? "localhost";

  return Task.CompletedTask;
}

Clone this wiki locally