Is there a way to get my Azure Function Trigger bindings to not binding to settings in the "Values" config section?

562 Views Asked by At

For example suppose I have this local.settings.json file:

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
  },
  "Kafka": {
    "BootstrapServers": "localhost:9092"
  }
}

And then I want my function to bind to settings in the "Kafka" section not the "Values" section. Such as:

[Function("hello")]
public void HelloKafka([KafkaTrigger("%Kafka:BootstrapServers%")] string input)
{
  Console.WriteLine(input);
}

But this seems to give the error

Error indexing method 'Functions.hello'. Microsoft.Azure.WebJobs.Host: '%Kafka:BootstrapServers%' does not resolve to a value.

If I move the settings into "Values": { "BootstrapServers": "" } and then change the setting to just be "%BootstrapServers%" then it works...

But I'm actually using this same settings file when running this same code as a non-function and so I want to be able to put these settings in sensible places grouped together.

Is there any way to tell the function binding to stop looking under "Values" and to just start from the root of the settings?

0

There are 0 best solutions below