简体   繁体   English

我可以为 Azure 函数绑定表达式配置默认值吗?

[英]Can I configure a default value for an Azure Functions binding expression?

I want to simplify deployment of my Azure Functions v3 project as much as possible.我想尽可能简化我的 Azure Functions v3 项目的部署。

As an example, take this function, which uses a binding expression to refer to the DoTheThingSchedule appsetting:例如,以这个 function 为例,它使用绑定表达式来引用DoTheThingSchedule应用程序设置:

[FunctionName("DoTheThing")]
public async Task Run([TimerTrigger("%DoTheThingSchedule%")]TimerInfo timer)
{
    // do the thing
}

For local development I can configure a value for DoTheThingSchedule in local.settings.json , but I haven't found a way to configure a default value in production, which means I'll always have to explicitly configure this setting in Azure.对于本地开发,我可以在local.settings.json中为DoTheThingSchedule配置一个值,但我还没有找到在生产中配置默认值的方法,这意味着我总是必须在 Azure 中显式配置此设置。

Does anyone know of a way to work around this?有谁知道解决这个问题的方法?

Azure needs you to add settings in configuration settings in azure. Azure 需要您在 azure 的配置设置中添加设置。 And it will not upload local.settings.json file to azure.并且它不会将 local.settings.json 文件上传到 azure。 But if you are using VS to publish, you can set the settings before publish:但是如果你是用VS来发布的,可以在发布前进行设置:

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM