Skip to content

Commit

Permalink
feat: initial code commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards1211 committed May 17, 2024
1 parent ee70e41 commit 9c201ea
Show file tree
Hide file tree
Showing 7 changed files with 510 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
.nyc_output
node_modules
/coverage
/.pgpass
/.get-pg-configrc.json
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
# @jcoreio/get-pg-options
# @jcoreio/get-pg-config

convenience wrapper for pg-connection-string/pgpass
apply default postgres connection config from dotfiles and .pgpass

[![CircleCI](https://circleci.com/gh/jcoreio/get-pg-options.svg?style=svg)](https://circleci.com/gh/jcoreio/get-pg-options)
[![Coverage Status](https://codecov.io/gh/jcoreio/get-pg-options/branch/master/graph/badge.svg)](https://codecov.io/gh/jcoreio/get-pg-options)
[![CircleCI](https://circleci.com/gh/jcoreio/get-pg-config.svg?style=svg)](https://circleci.com/gh/jcoreio/get-pg-config)
[![Coverage Status](https://codecov.io/gh/jcoreio/get-pg-config/branch/master/graph/badge.svg)](https://codecov.io/gh/jcoreio/get-pg-config)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![npm version](https://badge.fury.io/js/%40jcoreio%2Fget-pg-options.svg)](https://badge.fury.io/js/%40jcoreio%2Fget-pg-options)
[![npm version](https://badge.fury.io/js/%40jcoreio%2Fget-pg-config.svg)](https://badge.fury.io/js/%40jcoreio%2Fget-pg-config)

This solves two minor problems with `pg`'s default connection parameters:

- it doesn't read `~/.pgpass`/`PGPASSFILE`
- `user` defaults to the OS user. In our work we always use Docker and the `postgres` user,
so we can configure that as the default with the following in `package.json` or `.get-pg-configrc` etc:
```json
"get-pg-config": {
"defaults": {
"user": "postgres"
}
}
```
31 changes: 25 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@jcoreio/get-pg-options",
"description": "convenience wrapper for pg-connection-string/pgpass",
"name": "@jcoreio/get-pg-config",
"description": "apply default postgres connection config from dotfiles and .pgpass",
"repository": {
"type": "git",
"url": "https://github.com/jcoreio/get-pg-options.git"
"url": "https://github.com/jcoreio/get-pg-config.git"
},
"homepage": "https://github.com/jcoreio/get-pg-options",
"homepage": "https://github.com/jcoreio/get-pg-config",
"bugs": {
"url": "https://github.com/jcoreio/get-pg-options/issues"
"url": "https://github.com/jcoreio/get-pg-config/issues"
},
"author": "Andy Edwards",
"license": "MIT",
Expand All @@ -26,11 +26,18 @@
"@jcoreio/toolchain-mocha": "^4.5.5",
"@jcoreio/toolchain-semantic-release": "^4.5.5",
"@jcoreio/toolchain-typescript": "^4.5.5",
"@types/chai": "^4.0.0",
"@types/chai-subset": "^1.3.5",
"@types/mocha": "^10.0.6",
"@types/pg": "^8.11.6",
"@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^7.6.0",
"chai": "^4.0.0",
"chai-subset": "^1.6.0",
"eslint": "^8.56.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"mocha": "^10.2.0",
"pg": "^8.11.5",
"typescript": "^5.1.0"
},
"version": "0.0.0-development",
Expand All @@ -41,11 +48,23 @@
"test": "toolchain test",
"prepublishOnly": "echo This package is meant to be published by semantic-release from the dist build directory. && exit 1"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
"./package.json": "./dist/package.json",
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"engines": {
"node": ">=16"
},
"packageManager": "pnpm@8.11.0",
"dependencies": {
"@babel/runtime": "^7.18.6"
"@babel/runtime": "^7.18.6",
"cosmiconfig": "^9.0.0",
"pg": "^8.11.5",
"pgpass": "^1.0.5"
}
}
Loading

0 comments on commit 9c201ea

Please sign in to comment.