【问题标题】:Read Azure Function Setting from Configuration从配置中读取 Azure 功能设置
【发布时间】:2017-11-06 15:35:28
【问题描述】:

我正在使用带有属性的 Azure Functions 来定义功能。

public static class PostPublishTimerTrigger
{
    [FunctionName("PostPublishTimerTrigger")]
    public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer,
        TraceWriter log,
        [Queue("post-published")] ICollector<string> postPublishedQueue)
    {
          // Additional code here
    }
}

有没有办法为配置设置提取计划0 */5 * * * *,无论是Configuration Manager 还是Environment Variables

谢谢!

【问题讨论】:

    标签: azure azure-functions


    【解决方案1】:

    是的,你可以这样做

    [TimerTrigger("%schedule%")]
    

    然后添加一个名为schedule 的设置,其值为0 */5 * * * *

    【讨论】:

    • 这个设置是否会存在于 local.settings.json 或 AppSettings 中?
    • 在本地运行时在local.settings.json 中,在 Azure 中运行时在门户应用设置中
    猜你喜欢
    • 2019-01-23
    • 1970-01-01
    • 2013-11-07
    • 1970-01-01
    • 1970-01-01
    • 2020-10-17
    • 2019-11-02
    • 2010-12-30
    • 2022-07-21
    相关资源
    最近更新 更多