mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-18 18:56:24 +00:00
Allow newlines to be part of environment variables
We were not allowing newlines previously by virtue of the regex not allowing them. The docker daemon and supervisor handling code both support them, so we allow them in the parsing code too. Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
6bf008cc85
commit
49dbaaba12
@ -4,7 +4,7 @@ import { EnvVarObject } from './types';
|
||||
|
||||
export function envArrayToObject(env: string[]): EnvVarObject {
|
||||
const toPair = (keyVal: string) => {
|
||||
const m = keyVal.match(/^([^=]+)=(.*)$/);
|
||||
const m = keyVal.match(/^([^=]+)=([^]*)$/);
|
||||
if (m == null) {
|
||||
console.log(
|
||||
`WARNING: Could not correctly parse env var ${keyVal}. ` +
|
||||
|
@ -43,9 +43,11 @@ describe 'conversions', ->
|
||||
'key2=test\ntest',
|
||||
'key3=test ',
|
||||
'key4= test '
|
||||
'key5=test\r\ntest',
|
||||
])).to.deep.equal({
|
||||
key1: ' test',
|
||||
key2: 'test\ntest',
|
||||
key3: 'test ',
|
||||
key4: ' test ',
|
||||
key5: 'test\r\ntest'
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user