MCPcopy
hub / github.com/motdotla/dotenv / _vaultPath

Function _vaultPath

lib/main.js:192–214  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

190}
191
192function _vaultPath (options) {
193 let possibleVaultPath = null
194
195 if (options && options.path && options.path.length > 0) {
196 if (Array.isArray(options.path)) {
197 for (const filepath of options.path) {
198 if (fs.existsSync(filepath)) {
199 possibleVaultPath = filepath.endsWith('.vault') ? filepath : `${filepath}.vault`
200 }
201 }
202 } else {
203 possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`
204 }
205 } else {
206 possibleVaultPath = path.resolve(process.cwd(), '.env.vault')
207 }
208
209 if (fs.existsSync(possibleVaultPath)) {
210 return possibleVaultPath
211 }
212
213 return null
214}
215
216function _resolveHome (envPath) {
217 return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath

Callers 2

_parseVaultFunction · 0.85
configFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…