Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
postgres settings fact
def pg_setting(setting)
Facter.add("pg_" + setting) do
setcode do
if File.exists? "/usr/bin/psql"
setting = Facter::Util::Resolution.exec("sudo -u postgres psql -U postgres -d postgres -qtAXc \"select current_setting('#{setting}')\"")
end
end
end
end
settings = [
'archive_command',
'archive_mode',
'cpu_tuple_cost',
'datestyle',
'effective_cache_size',
'effective_io_concurrency',
'log_line_prefix',
'logging_collector',
'maintenance_work_mem',
'max_connections',
'random_page_cost',
'shared_buffers',
'timezone',
'track_activity_query_size',
'work_mem',
'data_directory',
'server_version'
]
settings.each do |setting|
pg_setting(setting)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment