Skip to content

Commit

Permalink
Remove multiline from env and cli options
Browse files Browse the repository at this point in the history
  • Loading branch information
motdotla committed Jan 31, 2022
1 parent 55b649a commit 1fa0581
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 20 deletions.
2 changes: 1 addition & 1 deletion lib/cli-options.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const re = /^dotenv_config_(encoding|path|debug|override|multiline)=(.+)$/
const re = /^dotenv_config_(encoding|path|debug|override)=(.+)$/

module.exports = function optionMatcher (args) {
return args.reduce(function (acc, cur) {
Expand Down
4 changes: 0 additions & 4 deletions lib/env-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,4 @@ if (process.env.DOTENV_CONFIG_OVERRIDE != null) {
options.override = process.env.DOTENV_CONFIG_OVERRIDE
}

if (process.env.DOTENV_CONFIG_MULTILINE != null) {
options.multiline = process.env.DOTENV_CONFIG_MULTILINE
}

module.exports = options
7 changes: 0 additions & 7 deletions tests/test-cli-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ const t = require('tap')

const options = require('../lib/cli-options')

t.plan(7)

// matches encoding option
t.same(options(['node', '-e', "'console.log(testing)'", 'dotenv_config_encoding=utf8']), {
encoding: 'utf8'
Expand All @@ -24,11 +22,6 @@ t.same(options(['node', '-e', "'console.log(testing)'", 'dotenv_config_override=
override: 'true'
})

// matches multiline option
t.same(options(['node', '-e', "'console.log(testing)'", 'dotenv_config_multiline=true']), {
multiline: 'true'
})

// ignores empty values
t.same(options(['node', '-e', "'console.log(testing)'", 'dotenv_config_path=']), {})

Expand Down
8 changes: 0 additions & 8 deletions tests/test-env-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const e = process.env.DOTENV_CONFIG_ENCODING
const p = process.env.DOTENV_CONFIG_PATH
const d = process.env.DOTENV_CONFIG_DEBUG
const o = process.env.DOTENV_CONFIG_OVERRIDE
const m = process.env.DOTENV_CONFIG_MULTILINE

// get fresh object for each test
function options () {
Expand All @@ -26,14 +25,11 @@ function testOption (envVar, tmpVal, expect) {
delete process.env[envVar]
}

t.plan(6)

// returns empty object when no options set in process.env
delete process.env.DOTENV_CONFIG_ENCODING
delete process.env.DOTENV_CONFIG_PATH
delete process.env.DOTENV_CONFIG_DEBUG
delete process.env.DOTENV_CONFIG_OVERRIDE
delete process.env.DOTENV_CONFIG_MULTILINE

t.same(options(), {})

Expand All @@ -49,12 +45,8 @@ testOption('DOTENV_CONFIG_DEBUG', 'true', { debug: 'true' })
// sets override option
testOption('DOTENV_CONFIG_OVERRIDE', 'true', { override: 'true' })

// sets multiline option
testOption('DOTENV_CONFIG_MULTILINE', 'true', { multiline: 'true' })

// restore existing env
process.env.DOTENV_CONFIG_ENCODING = e
process.env.DOTENV_CONFIG_PATH = p
process.env.DOTENV_CONFIG_DEBUG = d
process.env.DOTENV_CONFIG_OVERRIDE = o
process.env.DOTENV_CONFIG_MULTILINE = m

0 comments on commit 1fa0581

Please sign in to comment.