---
title: "Template Variable Functions, Cron Schedule via Config, New Plans on August 1"
date: 2023-07-28T15:00:00.000+00:00
number: 0144
url: https://railway.com/changelog/2023-07-28-template-variable-functions
---

# Template Variable Functions, Cron Schedule via Config, New Plans on August 1

You found it! The place where the changes are logged! Congrats!

This week we’re coming at you live and direct with a fistful of quality-of-life improvements. 

We’ve got some buffs to template vars and crons, some nerfs to annoying bugs, and a bunch of other improvements to go with it all.

Is everybody in?? 

The show is about to begin! 

## Template Variable Functions

[Image: It’s now possible to use functions within a variable value in Templates]

Did you ever wish you could inject a function into a variable value? Now you can! 

Let’s say you have a template that requires a secret as an environment variable. It’s now possible to assign a variable value of `secret()` which will then be evaluated when the template is deployed. How cool is that? 

To accomplish this, we’ve written a custom parser for variable references that supports `${{ function() }}` within a variable. 

Then as mentioned, the function is executed when the template is deployed, replacing the `${{ ... }}` with the resulting text. 

You can see an example of what the variable will look like after all the functions execute when creating the template.

There are two variable functions defined at the moment:

- `secret(length?: number, alphabet?: string)`: Generates a random secret (32 chars by default). This is useful when you need a password or secret variable but don’t want whoever is deploying the template to generate one every time. Now you can simply add `${{secret()}}` as the default value of a variable and a random secret will be generated for each deploy of the template.
- `randomInt(min?: number, max?: number)`: Generates a random integer between min and max (defaults to 0 and 100).

This is a fairly new feature and we are still experimenting with what the future of variable functions will look like.

If you have any suggestions for functions, [jump on Discord](https://discord.gg/invite/railway) and let us know!

## Cron Schedule Support

Have you given [Cron Jobs](https://railway.app/changelog/2023-07-14-volumes-generally-available#cron-jobs-to-priority-boarding) a try yet? 

It’s the third week in a row that we’re mentioning crons, but we wanted to let you know that by popular demand, it’s now possible to schedule a cron job from a `railway.toml` [config file](https://docs.railway.app/deploy/config-as-code#toml).

Here’s what that might look like:

```toml
[build]
builder = "nixpacks"
buildCommand = "echo building!"

[deploy]
startCommand = "echo starting!"
healthcheckPath = "/"
healthcheckTimeout = 100
restartPolicyType = "never"
cronSchedule = "0 6 2 * *"
```

The deployment above will run every second day of the month at 6:00 AM. 

To get started with Cron Jobs, make sure to join [Priority Boarding](https://docs.railway.app/reference/priority-boarding)!

We’ll see you over there. 

## New Plans on August 1

We wanted to remind you that the migration to [new plans](https://blog.railway.app/p/introducing-trial-hobby-pro-plans) will complete at 1:00pm UTC on August 1. If you have not yet upgraded to the Hobby or Pro plan by then, your workloads will be paused.

If you have any questions about what that means for you, we recommend checking out these resources:

- [Pre-announcement blogpost](https://blog.railway.app/p/introducing-trial-hobby-pro-plans)
- [Migration guide](https://blog.railway.app/p/pricing-and-plans-migration-guide-2023)
- [Pricing docs](https://docs.railway.app/reference/pricing)

If you still need to migrate your account to the new plans, try logging in to the [dashboard](https://railway.app/dashboard). 

We’ve also sent a number of reminder emails over the past few weeks letting you know what’s in store for this migration.

Still have questions? Jump on [Discord](https://discord.gg/invite/railway) and ask away. 

## Improvements and Fixes

- We improved the error messages when a [Docker image](https://railway.app/changelog/2023-07-07-docker-hub-priority-boarding#deploy-docker-images-to-priority-boarding) fails to deploy
- We fixed an issue with upstream environments when forking
- We added a number of clarifying states when setting up DNS
- We fixed an issue that sometimes caused the dashboard to reflow incorrectly when resizing
- We made it more clear how to disconnect and delete volumes in the dashboard