How to Effectively Manage Environment Variables in Modular Rails Apps with Hundreds of Variables?

This message was imported from the Ruby/Rails Modularity Slack server. Find more info in the import thread.

Message originally sent by slack user U729K0K9ZF5

General question for folks on your modular rails apps - there are tools like packwerk to make the code modular, and I see articles and discussion above modular models/schemas, but much less on managing environment - How do you manage your environment variables for rails apps with hundreds of env vars?

In particular, if you have a .env file that is hundreds (or more) of lines, how do you trace the env var to the modular code and effectively assign ownership and manage the lifecycle of that env var in various environments (local dev, remote non-prod, remote prod)?

Message originally sent by slack user U71N49ZTMNC

we’ve just started using https://github.com/palkan/anyway_config on a modest-sized rails app and so far so good. It’s clearly an improvement over a crazy long .env file.

Message originally sent by slack user U729K0K9ZF5

Wow, this looks perfect, thanks for sharing!

Message originally sent by slack user U729K0K9ZF5

Do you all still load from env vars? Is the app to the size that different teams need to own different env vars?

I see it has a Doppler data loader. We’ve looked at Doppler before, and componentizing config with Anyway, then easy loading from Doppler could be transformative for our DX and security.

Message originally sent by slack user U71N49ZTMNC

Nah we’re a single team of 5 still. We use a bunch of yml files for everything not secret, env vars for secrets. Never used doppler but sounds good :slight_smile:

Message originally sent by slack user U729K0K9ZF5

I wish we had started using this back when we were 5 people! :rolling_on_the_floor_laughing:

Message originally sent by slack user U71N49ZTMNC

Better late than never :joy: