Skip to content

Commit

Permalink
Merge pull request #797 from tran-simon/master
Browse files Browse the repository at this point in the history
fix: support array for path option
  • Loading branch information
motdotla committed Jan 24, 2024
2 parents a44cb3d + cfd735d commit 48a6ade
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/main.js
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 48a6ade

Please sign in to comment.