psql_camp - invoke the psql client for a camp PostgreSQL instanceVERSION
psql_camp [camp] [psql args]
Invokes the standard psql client shell, with appropriate connection parameters for working with your camp database.
First the utility checks the first argument supplied for a valid camp number. Failing that, it will attempt to determine your current camp from the current working directory. Any additional arguments provided will be passed along to the underlying psql call.DESCRIPTION
The camp system makes access to databases a bit tricky, since each camp's database (in this case, Postgres) listens on an alternate port or socket file, with each user account having custom, random passwords rather than consistent, widely known passwords. The psql_camp script is intended to simplify this, such that you may get to the Postgres client for your database painlessly without needing to know the custom port/socket, etc.
It does this by accessing the camp's configuration via the Camp::Master library, appropriately setting the $PGUSER and $PGDATABASE environment variables, and calling psql with the corresponding port for the camp.
Use the psql_camp script whenever you would use psql. Command line arguments will be passed along to the underlying psql call, as noted -- if the first argument consists entirely of digits, it will be interpreted as a camp number -- psql_camp [arguments] [camp] shouldn't work. Postgres will ask for a password if psql_camp is called using another user's [camp] number, or if your ~/.pgpass file doesn't provide the correct passwords for your camp's database.
If only one argument is provided, like a database name that looks like a camp number, it will be read as a camp number! Passing a dbname to psql with the -d option preceding it disambiguates the two.AUTHOR
Jon Jensen <email@example.com> and other contributorsLICENSE AND COPYRIGHT
Copyright (C) 2006-2015 End Point Corporation, https://www.endpoint.com/
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see: http://www.gnu.org/licenses/
© 2006–2019 End Point Corporation