Skip to content

Instantly share code, notes, and snippets.

@jaredcurtis
Created March 13, 2014 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaredcurtis/9519725 to your computer and use it in GitHub Desktop.
Save jaredcurtis/9519725 to your computer and use it in GitHub Desktop.
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