R
Railway8mo ago
dubs

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
Percy
Percy8mo ago
Project ID: N/A
dubs
dubsOP8mo ago
N/A
Brody
Brody8mo 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
dubs
dubsOP8mo ago
Hm alright, I'll do some testing
Brody
Brody8mo ago
mind sharing your usecase?
dubs
dubsOP8mo ago
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
Brody
Brody8mo ago
ah cool, was RAILWAY_REPLICA_ID sufficient to get that up and working?
dubs
dubsOP8mo ago
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
Brody
Brody8mo ago
makes sense
Want results from more Discord servers?
Add your server