Skip to content

Commit

Permalink
fix: support array for path option
Browse files Browse the repository at this point in the history
  • Loading branch information
tran-simon committed Jan 23, 2024
1 parent a44cb3d commit cfd735d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,18 @@ function configDotenv (options) {

if (options) {
if (options.path != null) {
dotenvPath = _resolveHome(options.path)
let envPath = options.path

if (Array.isArray(envPath)) {
for (const filepath of options.path) {
if (fs.existsSync(filepath)) {
envPath = filepath
break
}
}
}

dotenvPath = _resolveHome(envPath)
}
if (options.encoding != null) {
encoding = options.encoding
Expand Down

0 comments on commit cfd735d

Please sign in to comment.