Created
March 13, 2014 00:39
-
-
Save jaredcurtis/9519725 to your computer and use it in GitHub Desktop.
postgres settings fact
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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