mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-22 18:22:41 +00:00
Auto-merge for PR #665 via VersionBot
Ignore leading and trailing whitespace when parsing env vars
This commit is contained in:
commit
8018b960aa
@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
|
|||||||
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## v7.7.2 - 2018-05-22
|
||||||
|
|
||||||
|
* Ignore leading and trailing whitespace when parsing env vars #665 [Cameron Diver]
|
||||||
|
|
||||||
## v7.7.1 - 2018-05-21
|
## v7.7.1 - 2018-05-21
|
||||||
|
|
||||||
* Don't generate config fields in offline mode #651 [Cameron Diver]
|
* Don't generate config fields in offline mode #651 [Cameron Diver]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "resin-supervisor",
|
"name": "resin-supervisor",
|
||||||
"description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.",
|
"description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.",
|
||||||
"version": "7.7.1",
|
"version": "7.7.2",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -4,7 +4,7 @@ import { EnvVarObject } from './types';
|
|||||||
|
|
||||||
export function envArrayToObject(env: string[]): EnvVarObject {
|
export function envArrayToObject(env: string[]): EnvVarObject {
|
||||||
const toPair = (keyVal: string) => {
|
const toPair = (keyVal: string) => {
|
||||||
const m = keyVal.match(/^([^=]+)=(.*)$/);
|
const m = keyVal.match(/^([^=]+)=\s*(.*)\s*$/);
|
||||||
if (m == null) {
|
if (m == null) {
|
||||||
console.log(`WARNING: Could not correctly parse env var ${keyVal}. ` +
|
console.log(`WARNING: Could not correctly parse env var ${keyVal}. ` +
|
||||||
'Please fix this var and recreate the container.');
|
'Please fix this var and recreate the container.');
|
||||||
|
@ -36,3 +36,14 @@ describe 'conversions', ->
|
|||||||
expect(conversion.envArrayToObject('')).to.deep.equal({})
|
expect(conversion.envArrayToObject('')).to.deep.equal({})
|
||||||
expect(conversion.envArrayToObject([])).to.deep.equal({})
|
expect(conversion.envArrayToObject([])).to.deep.equal({})
|
||||||
expect(conversion.envArrayToObject(1)).to.deep.equal({})
|
expect(conversion.envArrayToObject(1)).to.deep.equal({})
|
||||||
|
|
||||||
|
it 'should ignore leading and trailing whitespace', ->
|
||||||
|
expect(conversion.envArrayToObject([
|
||||||
|
'TEST=\ntest'
|
||||||
|
'TEST2=test\n'
|
||||||
|
'TEST3=\ntest\n'
|
||||||
|
])).to.deep.equal({
|
||||||
|
TEST: 'test'
|
||||||
|
TEST2: 'test'
|
||||||
|
TEST3: 'test'
|
||||||
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user