Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timer trigger schedule configuration options #1934

Closed
gleizerowicz opened this issue Sep 21, 2017 · 2 comments
Closed

Timer trigger schedule configuration options #1934

gleizerowicz opened this issue Sep 21, 2017 · 2 comments

Comments

@gleizerowicz
Copy link

I'm using the new C# assembly deployments in Azure Functions.

I want to be able to configure my timer trigger schedule differently in pre-production environments (less frequently) than in production. I'm running a script in my VSTS release to modify the function.json file in the web deploy package before deploying to my App Service.

It looks like whatever string is passed into the TimerTriggerAttribute constructor overrides the value in function.json. I've tried the second overload of the constructor to avoid compiling the schedule into the assembly but the compiler throws an error that the ScheduleType property is not supported.

Is there any supported way of configuring timer schedules differently in different environments, other than compiling different versions of the assembly?

@anthonychu
Copy link
Member

Yes. Instead of hardcoding a cron expression, put the expression in an app setting and refer to it using % signs. For instance, if you have a setting called CRON_EXPRESSION:

public static void Run([TimerTrigger("%CRON_EXPRESSION%")]TimerInfo myTimer, TraceWriter log)

@gleizerowicz
Copy link
Author

Thanks @anthonychu I know I read about using settings this way at some point but I must have forgotten.

@ghost ghost locked as resolved and limited conversation to collaborators Jan 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants