mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:57:10 -06:00
FEATURE: allow setting postgres connection variables via environment
This commit is contained in:
parent
99dadb2129
commit
dda1cd6a38
@ -154,6 +154,14 @@ class GlobalSetting
|
||||
hash["reaping_frequency"] = connection_reaper_interval if connection_reaper_interval.present?
|
||||
hash["advisory_locks"] = !!self.db_advisory_locks
|
||||
|
||||
db_variables = provider.keys.filter { |k| k.to_s.starts_with? 'db_variables_' }
|
||||
if db_variables.length > 0
|
||||
hash["variables"] = {}
|
||||
db_variables.each do |k|
|
||||
hash["variables"][k.slice(('db_variables_'.length)..)] = self.public_send(k)
|
||||
end
|
||||
end
|
||||
|
||||
{ "production" => hash }
|
||||
end
|
||||
|
||||
|
@ -13,6 +13,9 @@ development:
|
||||
### - restart sidekiq if you change this setting
|
||||
### - rebake all to posts using: `RAILS_ENV=production bundle exec rake posts:rebake`
|
||||
- "localhost"
|
||||
variables: <%= ENV.filter { |k,v| k.start_with? 'DISCOURSE_DB_VARIABLES_' }
|
||||
.transform_keys { |k| k.slice(('DISCOURSE_DB_VARIABLES_'.length)..).downcase }
|
||||
.to_json %>
|
||||
|
||||
# Warning: The database defined as "test" will be erased and
|
||||
# re-generated from your development database when you run "rake".
|
||||
|
Loading…
Reference in New Issue
Block a user