Skip to content

Commit 48a6ade

Browse files
authored
Merge pull request #797 from tran-simon/master
fix: support array for path option
2 parents a44cb3d + cfd735d commit 48a6ade

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/main.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,18 @@ function configDotenv (options) {
209209

210210
if (options) {
211211
if (options.path != null) {
212-
dotenvPath = _resolveHome(options.path)
212+
let envPath = options.path
213+
214+
if (Array.isArray(envPath)) {
215+
for (const filepath of options.path) {
216+
if (fs.existsSync(filepath)) {
217+
envPath = filepath
218+
break
219+
}
220+
}
221+
}
222+
223+
dotenvPath = _resolveHome(envPath)
213224
}
214225
if (options.encoding != null) {
215226
encoding = options.encoding

0 commit comments

Comments
 (0)