如何在本地覆盖我的 azure 函数的主机设置? [英] How can I override the host settings of my azure function locally?
问题描述
假设你有一个这样的 host.json 文件:
Say you have a host.json file like this:
{
"version": "2.0",
"extensions": {
"serviceBus": {
"messageHandlerOptions": {
"maxConcurrentCalls": 16,
"maxAutoRenewDuration": "00:05:00"
}
}
}
}
但您希望在本地覆盖 local.settings.json
或 Azure 上给定环境的设置中的设置.有可能吗,你是怎么做到的?
But you wish to override the setting locally in local.settings.json
or in the settings for a given environment on Azure. Is it possible, and how do you do it?
推荐答案
这是可能的,但文档很少.Fabio Cavalcante 在评论中描述了它 这里.
It is possible, but poorly documented. Fabio Cavalcante describes it in a comment here.
您只需在 local.settings.json
文件(或在 Azure 上)中为设置添加 AzureFunctionsJobHost
前缀,如下所示:
You simply have to prefix the setting with AzureFunctionsJobHost
in your local.settings.json
file (or on Azure) like this:
{
"IsEncrypted": false,
"Values": {
"AzureFunctionsJobHost:Extensions:ServiceBus:MessageHandlerOptions:MaxConcurrentCalls": 32,
"AzureFunctionsJobHost:Extensions:ServiceBus:MessageHandlerOptions:MaxAutoRenewDuration": "00:10:00"
}
}
您也可以使用双下划线 (__
) 代替冒号 (:
).
You can also use double underscore (__
) instead of colon (:
).
这篇关于如何在本地覆盖我的 azure 函数的主机设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!