Skip to content

Conversation

@elquimista
Copy link

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.

Copy link
Collaborator

@geoffharcourt geoffharcourt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. One tiny change in the code, and could you put your PR description in the commit description along with a README change to show how someone could use this?

PROTECTED_ENVIRONMENTS = %w(development production)

attr_accessor :app_argument, :environment, :subcommand, :arguments
attr_accessor :psql_argument
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this join the above attr_accessors?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

@elquimista
Copy link
Author

@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?

Copy link
Collaborator

@geoffharcourt geoffharcourt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there's some CI failures to resolve.

@geoffharcourt
Copy link
Collaborator

geoffharcourt commented Jan 15, 2020

@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
Copy link
Author

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

@geoffharcourt
Copy link
Collaborator

geoffharcourt commented Jun 24, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants