rubyconfig / config

Easiest way to add multi-environment yaml settings to Rails, Sinatra, Padrino and other Ruby projects.
Other
2.11k stars 231 forks source link

Pioneer's question #308

Closed kshnyakin closed 3 years ago

kshnyakin commented 3 years ago

Hello all! Question from pioneer. Start settings is Settings.some_secret = "wow" I have changed settings via adding raw hash, smth like this:

Settings.add_source!({some_secret: "super"})
Settings.reload!

After that in my App Settings.some_secret # super - nice! But when I make Settings.some_secret in sidekiq, that's work with the same app - I see old value = "wow" - not very nice.

How can I synchronize Settings value through all child-apps like sidekiq / consumers etc?

Fryguy commented 3 years ago

If I'm understanding correctly, the raw hash cannot be synchronized across processes because there's no way for 2 processes to know each other's memory. You'd have to use something that can span processes like a second yml file in one of the standard locations, or use ENV vars that map into settings, and ensure each process can see the ENV var.