2016-10-31 23:22:38 +00:00
|
|
|
import * as plugins from './smartstring.plugins'
|
2016-04-15 22:58:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* converts an erray of env strings from docker remote api to an usable object.
|
|
|
|
* @param envArrayArg
|
|
|
|
* @returns {}
|
|
|
|
*/
|
2016-08-03 13:41:36 +00:00
|
|
|
export let makeEnvObject = function (envArrayArg: string[]) {
|
2016-10-31 23:22:38 +00:00
|
|
|
let returnObject = {}
|
|
|
|
let regexString = /(.*)=(.*)/
|
|
|
|
if (typeof envArrayArg !== 'undefined') {
|
2016-08-03 13:41:36 +00:00
|
|
|
for (let envKey in envArrayArg) {
|
2016-10-31 23:22:38 +00:00
|
|
|
let regexMatches = regexString.exec(envArrayArg[envKey])
|
|
|
|
returnObject[regexMatches[1]] = regexMatches[2]
|
2016-08-03 13:41:36 +00:00
|
|
|
};
|
|
|
|
}
|
2016-10-31 23:22:38 +00:00
|
|
|
return returnObject
|
|
|
|
}
|