a month ago
The CLI example for deploying a template implicitly suggests that Railway's platform supports setting a subset of env vars when deploying a template:
railway deploy -t postgres -v "MY_SPECIAL_ENV_VAR=1" -v "Backend.Port=3000"This appears to not be the case via the GraphQL API, and a maximalist explicit config is required in the serializedConfig input to the mutation.
I'm wondering whether there's something I've missed? It feels rather fragile to maintain an explicit full config in my shell script I'm building to deploy the template in an automated context.
The full serialized config is almost 1000 lines of JSON, and I'll have to manually keep it up-to-date with the template by deploying via the web GUI and inspecting the network tab. This is a DX nightmare.
The template has default ENV values for a reason. I'd like to be able to merge a subset of ENV vars in the mutation and have the rest applied with their defaults. It seems like the CLI performs this, I'm wondering how it achieves it? I'm not a rust dev so not interested in figuring out the CLI myself at this stage. Would appreciate some insight, thank you!
0 Replies
a month ago
The Railway CLI is public and they also use the serialized_config option:
From my Rusty understanding, the CLI fetches the template details and then creates it.
I hoped there was a simple way to not have to build the entire explicit config myself. I see there is an endpoint to fetch a template by ID, look at the default config, and merge in the ones you need to set. Not the smoothest DX but we can make it happen 🙂
Def better than maintaining a 1000-line JSON in my project that can easily fall out-of-sync with the state of the template
a month ago
Yep, that's the way to go for now unfortunately and exactly what the CLI does.
a month ago
!s
Status changed to Solved passos • about 1 month ago