3 ms·
I use postgresql + listen/notify to share and push configuration out to applications. Each application starts a thread that LISTEN's for NOTIFY's from postgres
by joevandyk 13y ago
I use postgresql + listen/notify to share and push configuration out to applications.
Each application starts a thread that LISTEN's for NOTIFY's from postgresql.
I have a settings table (name text, value text). Configuration data is stored there.
insert into settings (name, value) values
('sites.my-site.authnet.api_key', 'asdfasdf');
There's a trigger on that table that issues a NOTIFY to all the clients. When the clients receive the NOTIFY, they query the table and store all of the settings in memory.
It works great.
No additional moving parts. All my configuration is stored in the database, they aren't checked into files that need to be protected. No security concerns about api keys stored in a separate service. My settings are backed up along with the rest of my data.
- enigmo 13y agoIf you already have to maintain a database and don't need lease/lock management or simple failover... broadcasting configuration values is pretty simple, sure.