2 years ago
How can I assign a different token environment variable to each replica? Or have the replicas choose from a list of them in one env var or something
9 Replies
2 years ago
There is no way to manually provide a specific variable per replica but each replica will get a unique RAILWAY_REPLICA_ID variable -
https://docs.railway.app/reference/variables#railway-provided-variables
2 years ago
mind sharing your usecase?
Basically I have worker bots that get sent requests through rabbitmq to process, and each one has a different api token it uses
It could probably be done without replicas and just in one script, but it's nice having rabbitmq deal with distribution and a few other things
2 years ago
ah cool, was RAILWAY_REPLICA_ID sufficient to get that up and working?
since the replica ids change every time the project changes, I don't really see a way it can be used with that, but I figured out that I can distribute the api tokens using a semaphore system with rabbitmq
2 years ago
makes sense