8000 Release Allow to add identifiers · adonisjs/env · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow to add identifiers

Compare
Choose a tag to compare
@RomainLanz RomainLanz released this 30 Mar 14:58
· 9 commits to develop since this release

This release adds the possibility to define identifier.
The identifier is a string that prefix the environment variable value and let you customize the value resolution.

import { readFile } from 'node:fs/promises'
import { EnvParser } from '@adonisjs/env'

EnvParser.identifier('file', (value) => {
  return readFile(value, 'utf-8')
})

const envParser = new EnvParser(`
  DB_PASSWORD=file:/run/secret/db_password
`)

console.log(await envParser.parse()) // { DB_PASSWORD: 'Value from file /run/secret/db_password' }

Breaking

The parse method of the EnvParser class is now async.

Commits

  • Merge pull request #37 from adonisjs/feat/identifier e7574df
  • feat(parser): allow to escape identifier fbba16b
  • test(parser): ensure identifier can be escaped b5b63fa
  • fix(parser): ensure identifier fully-match before using it 821ef92
  • feat(parser): allow to add identifiers 0e612ae

v5.0.1...v6.0.0

0