Security News
UK Officials Consider Banning Ransomware Payments from Public Entities
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
pg-connection-from-env
Advanced tools
Convert environment variables into a usable postgres connection object or postgres uri
Convert environment variables into a usable postgres connection object or postgres uri
yarn add pg-connection-from-env
import getPgConnectionFromEnv, {
getConnectionStringFromEnv,
} from "pg-connection-from-env"
getPgConnectionFromEnv()
// {
// host: 'localhost',
// user: 'postgres',
// port: 5432,
// password: '',
// database: 'postgres',
// ssl: false
// }
getPgConnectionFromEnv({
fallbackDefaults: {
user: "userifenvdoesntprovide",
database: "databaseifenvdoesntprovide",
},
})
// {
// host: 'localhost',
// user: 'userifenvdoesntprovide',
// port: 5432,
// password: '',
// database: 'databaseifuserdoesntprovide',
// ssl: false
// }
getConnectionStringFromEnv(/* same args as getPgConnectionFromEnv */)
// "postgresql://postgres:@localhost:5432/postgres"
Argument | Description |
---|---|
fallbackDefaults | Defaults if env does not provide host, database, user etc. |
user | Override user with this |
database | Override env database with this |
env | Environment object to use instead of process.env |
The following environment variables are used (basically standard postgres env variables)
Var Name | Description |
---|---|
POSTGRES_HOST | Postgres Host |
POSTGRES_PASS, POSTGRES_PASSWORD | Postgres Password |
POSTGRES_DATABASE, POSTGRES_DB | Postgres Database |
POSTGRES_USER, POSTGRES_USERNAME | Postgres User |
POSTGRES_PORT | Postgres Port |
POSTGRES_URI, POSTGRES_URL, PG_URI, DATABASE_URL | Postgres URI postgresql://... |
POSTGRES_SSL | If set, true |
FAQs
Convert environment variables into a usable postgres connection object or postgres uri
We found that pg-connection-from-env demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.