Skip to content

Commit

Permalink
move PGPASSWORD to env
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Oct 18, 2024
1 parent 9d9fa34 commit df09816
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions hooks/pre/10-reset_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ def reset_candlepin
end

def pg_command_base(config, command, args)
"PGPASSWORD='#{config[:password]}' #{command} -U #{config[:username]} -h #{config[:host]} -p #{config[:port]} #{args}"
"#{command} -U #{config[:username]} -h #{config[:host]} -p #{config[:port]} #{args}"
end

def pg_env(config)
{ 'PGPASSWORD' => config[:password] }
end

def pg_sql_statement(config, statement)
Expand All @@ -67,7 +71,7 @@ def pg_sql_statement(config, statement)
# WARNING: deletes all the data owned by the user. No warnings. No confirmations.
def empty_database!(config)
delete_statement = 'DROP OWNED BY CURRENT_USER CASCADE;'
execute!(pg_sql_statement(config, delete_statement), false, true)
execute!(pg_sql_statement(config, delete_statement), false, true, pg_env(config))
end

def clear_pulpcore_content(content_dir)
Expand Down

0 comments on commit df09816

Please sign in to comment.