Unique variables for replicas
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
Project ID:
N/A
N/A
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-variablesHm alright, I'll do some testing
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
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
makes sense