Skip to content

Commit

Permalink
feat: enable to specify dotenv file
Browse files Browse the repository at this point in the history
  • Loading branch information
acro5piano committed Mar 18, 2024
1 parent 93169bc commit 4681e01
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -29,6 +29,7 @@
"devDependencies": {
"@types/node": "^20.2.3",
"@types/pg": "^8.10.1",
"dotenv": "^16.4.5",
"kysely": "^0.24.2",
"pg": "^8.11.0",
"pg-cursor": "^2.10.0",
Expand Down
6 changes: 5 additions & 1 deletion src/cli.ts
Expand Up @@ -8,7 +8,11 @@ import { Pool } from 'pg'
* Load Dotenv if the module exists.
*/
try {
require('dotenv').config()
require('dotenv').config({
debug: !!process.env.DOTENV_CONFIG_DEBUG,
path: process.env.DOTENV_CONFIG_PATH,
encoding: process.env.DOTENV_CONFIG_ENCODING,
})
} catch {}

const { DATABASE_URL } = process.env
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Expand Up @@ -31,6 +31,11 @@ commander@^11.0.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-11.0.0.tgz#43e19c25dbedc8256203538e8d7e9346877a6f67"
integrity sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==

dotenv@^16.4.5:
version "16.4.5"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f"
integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==

kysely@^0.24.2:
version "0.24.2"
resolved "https://registry.yarnpkg.com/kysely/-/kysely-0.24.2.tgz#caf3be037939bd20449c0b7840e932f074b4d12c"
Expand Down

0 comments on commit 4681e01

Please sign in to comment.