How can I pass different values for the cron so that I can schedule the function at different times in different environments?
Previously I had the cron value hardcoded in the schedule, like:
export const nameFunction = functions
.region(...regions)
.runWith({
timeoutSeconds: 540,
memory: '128MB',
})
.pubsub.schedule("*/5 * * * *")
.timeZone('Europe/Copenhagen')
.onRun(async (context) => {
My goal is to change that to a config or secret in order to make it variable accordingly to the environment that it's deployed. Example: Dev: 5 minutes, Staging - 10 minutes, Prod - 1 day.
I've tried a couple of things but it simply doesn't work. This is my latest piece of code.
export const nameFunction = functions
.region(...regions)
.runWith({
timeoutSeconds: 540,
memory: '128MB',
secrets: ['CRON'],
})
.pubsub.schedule(process.env.CRON as string)
.timeZone('Europe/Copenhagen')
.onRun(async (context) => {