Skip to content

Commit cfd735d

Browse files
committed
fix: support array for path option
1 parent a44cb3d commit cfd735d

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)