pgRITA.com client
npm install pgritaUsage:
```
npx pgrita
[--token
[--project
[--connection
[--gitBranch
[--gitHash
The following CLI arguments are required unless the relevant environmental
variable is supplied:
- --token : your authentication token from pgRITA.com; alternativelyPGRITA_TOKEN
supply via the environmental variable.--project
- : the name of your project on pgRITA.com; alternativelyPGRITA_PROJECT
supply via the environmental variable.--connection
- : connection string to your PostgreSQL database (seeDATABASE_URL
below); alternatively supply via the environmental variable.
The command will exit with success (0 exit code) if introspection is
successful, the upload is successful, the results from your database analysis
are retrieved within the allotted timeout (30 seconds, normally much faster),
and the analysis results show no errors. In all other cases the command will
exit with a non-zero status code indicating failure.
This command is suitable for use in your CI workflow.
If you don't supply git branch/hash via the --gitBranch and --gitHash flags,
we will attempt to determine your git branch and git hash by using these
continuous integration environmental variables:
- GitHub Actions:
- branch: GITHUB_REFGITHUB_SHA
- hash: CIRCLE_BRANCH
- Circle CI
- branch: CIRCLE_SHA1
- hash: TRAVIS_PULL_REQUEST_BRANCH
- Travis CI
- branch: or TRAVIS_BRANCHTRAVIS_COMMIT
- hash:
Failing that, we'll try and extract them from the local git repository by
running the following commands:
- git branch: git rev-parse --abbrev-ref HEADgit rev-parse --verify HEAD
- git hash:
If this fails, we'll progress without branch/hash.
If you have PostgreSQL installed locally using trust authentication, your
database name may suffice. Otherwise a standard PostgreSQL connection URI (e.g.
postgres://user:password@host:port/dbname) should be supplied. If yourERROR: no pg_hba.conf entry for host "xxx.xxx.xxx.xxx", user ", database "", SSL off
PostgreSQL connection requires SSL (e.g. error such as),?ssl=true
you may need to add to the connection string. If you get an errorERROR: self signed certificate
such as then the quickest fix is to add?ssl=no-verify; there are other more proper fixes but they're somewhatpg` module (https://node-postgres.com/) as our PostgreSQL
complex - we use the
client, so more instructions can be found there (or ask on the
Graphile Discord).
You can read more about connection strings here:
- https://www.npmjs.com/package/pg-connection-string
- https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING