(options)
| 190 | } |
| 191 | |
| 192 | function _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 | |
| 216 | function _resolveHome (envPath) { |
| 217 | return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath |
no outgoing calls
no test coverage detected
searching dependent graphs…