twingly / twingly-amqp

:bus: Ruby gem for RabbitMQ subscribing and publishing
0 stars 0 forks source link

ENV naming for multiple servers #72

Open jage opened 5 years ago

jage commented 5 years ago

Currently we're using the following scheme for multiple servers, a new variable per server:

But for a lot of other servers we use:

So the question is, what do we prefer?

I'm leaning towards using _SERVERS or _URLS with a comma-separated list, that seems to be a general consensus among other gems.

I think using fewer variables could be positive during maintenance, as in it's easier to change a variable than make sure it's removed (Consul KV, Heroku config etc).

dentarg commented 5 years ago

Sure, I agree.

I prefer _SERVERS, as RABBITMQ_URL exists, which is the full connection string.

We should probably include the port number in the list of servers, and use make use of :addresses in Bunny. (We use :hosts now.)

I think this commit was our first used of RABBITMQ_NN_HOST, 17 Jun 2015. Bunny added :addresses Jul 30, 2015. :)

dentarg commented 5 years ago

We should probably include the port number in the list of servers, and use make use of :addresses in Bunny. (We use :hosts now.)

I need this for https://github.com/twingly/imse/pull/56. GitHub Actions assign ports randomly to services: https://github.com/actions/example-services/blob/dfd84e0637dda63c0359a07a7161fbfd2a6da738/.github/workflows/postgres-service.yml#L52-L54

dentarg commented 5 years ago

Oh, we have this: https://github.com/twingly/twingly-amqp#customize-options. I will try it.

dentarg commented 5 years ago

Seems to work