Using Config as Code
Railway supports defining the configuration for a single deployment in a file
alongside your code in a
Everything in the build and deploy sections of the service settings page can be specified in this configuration file.
The settings in the dashboard will not be updated with the settings defined in code. Configuration defined in code will always override values from the dashboard.
The format you use for your config-as-code (toml or json) file is entirely dependent on preference, and the resulting behavior in Railway is the same no matter which you choose.
For example, these configuration definitions are equivalent:
If you include it in your
railway.json file, many editors (e.g. VSCode) will provide autocomplete and documentation.
On a service's deployment details page, all the settings that a deployment went out with are shown.
For settings that come from a configuration file, there is a file icon. Hovering over the icon will show exactly what part of the file the values originated from.
You can use a custom config file by setting it on the service settings page. The file is relative to your app source.
Find a list of all of the configurable settings in the config as code reference page.
Edit this file on GitHub