thoughtbot / parity

Shell commands for development, staging, and production parity for Heroku apps
https://thoughtbot.com
MIT License
889 stars 57 forks source link

Allow additional psql argument #173

Open elquimista opened 4 years ago

elquimista commented 4 years ago

Allows using parity with non-default pg config (non-socket, different host, different username, with password etc), e.g. in local docker container environment with pg as a linked service (specified in docker-compose.yml).

One can create a customized version of development bin file and do the following:

  #!/usr/bin/env ruby

  $LOAD_PATH.unshift File.expand_path(File.join("..", "..", "lib"), __FILE__)
  require "parity"

  if ARGV.empty?
    puts Parity::Usage.new
  else
+   psql_arg = "-h postgres -U postgres"
+   exit Parity::Environment.new('development', ARGV, psql_argument: psql_arg).run
-   exit Parity::Environment.new('development', ARGV).run
  end

combined with PGPASSWORD env variable to run pg command lines non-interactively.

elquimista commented 4 years ago

@geoffharcourt I'll update README. Did you mean I put the PR description into the next commit desc? I thought GitHub will automatically put the PR desc into the merge commit desc when we click merge button?

geoffharcourt commented 4 years ago

@elquimista I think it only does that with merge commits, which we haven't used on this project. With the "Rebase and Merge" button or "Squash and Merge" button the commit history is retained but not replaced with the PR.

elquimista commented 4 years ago

@geoffharcourt I'll do that then, no problem. Which one do we do exactly btw, Squash or Rebase?

geoffharcourt commented 4 years ago

@elquimista sorry for the delay! I'll merge it with dispatch. Thanks for your contribution!