Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: add tests for PGPASSFILE and PGSERVICEFILE #82389

Merged
merged 1 commit into from
Jun 4, 2022

Conversation

rafiss
Copy link
Collaborator

@rafiss rafiss commented Jun 3, 2022

Release note (cli change): The CLI now supports connecting with PGPASSFILE
and PGSERVICEFILE. The behavior is compatible with how libpq (the psql C
library) behaves.

PGPASSFILE defaults to ~/.pgpass. It is a file that contains lines in the format

hostname:port:database:username:password

The password field from the first line that matches the current connection
parameters will be used to connect to the database.

PGSERVICEFILE defaults to ~/.pg_service.conf. It is a file that contains
lines in the format

[myservice]
host=somehost
port=26257
user=someuser

Any connection parameters (including passfile or password) can be specified here.
Then, a connection string that specifies the service=myservice connection
parameter will use the values in PGSERVICEFILE to connect.

Release note (cli change): The CLI now defaults to using the the file in
~/.postgresql/root.crt for the sslrootcert when connecting. The file can
still be configured using the PGSSLROOTCERT environment variable or
the sslrootcert URL parameter.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@rafiss rafiss force-pushed the pg-conn-tests branch 2 times, most recently from 0ce0cbc to c902e63 Compare June 3, 2022 14:40
@rafiss rafiss marked this pull request as ready for review June 3, 2022 14:41
@rafiss rafiss requested a review from a team as a code owner June 3, 2022 14:41
@rafiss rafiss requested a review from knz June 3, 2022 14:41
@rafiss rafiss changed the title cli: add tests for PGPASS and PGSERVICEFILE cli: add tests for PGPASSFILE and PGSERVICEFILE Jun 3, 2022
Copy link
Contributor

@knz knz left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rafiss)


-- commits line 4 at r1:
"The CLI" ->

CLI commands that use a SQL connection (e.g. `cockroach sql`, `cockroach node status`, etc) now ...

ditto below

Release note (cli change): CLI commands that use a SQL connection (e.g.
`cockroach sql`, `cockroach node status`, etc) now support connecting
with PGPASSFILE and PGSERVICEFILE. The behavior is compatible with how
libpq (the psql C library) behaves.

PGPASSFILE defaults to ~/.pgpass. It is a file that contains lines in the format
```
hostname:port:database:username:password
```
The password field from the first line that matches the current connection
parameters will be used to connect to the database.

PGSERVICEFILE defaults to ~/.pg_service.conf. It is a file that contains
lines in the format
```
[myservice]
host=somehost
port=26257
user=someuser
```
Any connection parameters (including passfile or password) can be specified here.
Then, a connection string that specifies the `service=myservice` connection
parameter will use the values in PGSERVICEFILE to connect.

Release note (cli change): CLI commands that use a SQL connection (e.g.
`cockroach sql`, `cockroach node status`, etc) now default to using
the the file in ~/.postgresql/root.crt for the `sslrootcert` when
connecting. The file can still be configured using the PGSSLROOTCERT
environment variable or the `sslrootcert` URL parameter.
Copy link
Collaborator Author

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

tftr!

bors r=knz

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @knz)


-- commits line 4 at r1:

Previously, knz (kena) wrote…

"The CLI" ->

CLI commands that use a SQL connection (e.g. `cockroach sql`, `cockroach node status`, etc) now ...

ditto below

fixed

@craig
Copy link
Contributor

craig bot commented Jun 3, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jun 3, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jun 4, 2022

Build succeeded:

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.

None yet

3 participants