如何在本地覆盖Azure函数的主机设置? [英] How can I override the host settings of my azure function locally?

查看:138
本文介绍了如何在本地覆盖Azure函数的主机设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设您有一个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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆