Reading variables from app settings another time in Azure Function App

  Kiến thức lập trình

I have a function app, the app settings has several different PATs
One of the function is an HTTP trigger, the request body will contain a specific name
and that name should be used to retrieve the corresponding PAT from app settings

I have tried Environment.GetEnvironmentVariable, this doesnt seem to read from app settings at all

I have tried

var configuration = builder.GetContext().Configuration;
var pat = configuration[$"{name}_PAT"];

this was a struggle because the {name} is only available after the POST request comes in, and configuration read the app settings in startup.cs, which is before the function getting triggered

I also cant use configuration after the request had come in because of the {name} and public abstract void Configure(IFunctionsHostBuilder builder) from FunctionsStartup doesn’t have any forms that would take a string that’s needed for the {name}

New contributor

nevermonday is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT