g2-ops-config
Advanced tools
Comparing version 0.0.11 to 0.0.12
@@ -61,3 +61,6 @@ 'use strict'; | ||
function fetchConfigurations(application, profiles) { | ||
function fetchConfigurations() { | ||
var application = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : configParams.application; | ||
var profiles = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : configParams.profiles; | ||
var yamlPromises = profiles.map(function (profile) { | ||
@@ -64,0 +67,0 @@ return getYamlPromise(profile, application); |
{ | ||
"name": "g2-ops-config", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "To fetch and maintain cloud configs for difference projects", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -34,7 +34,7 @@ // @flow | ||
function getYamlPromise(profile, application) { | ||
return axios.get(configFileURL(profile, application)).then((response) => response.data) | ||
return axios.get(configFileURL(profile, application)).then(response => response.data) | ||
} | ||
function injectProcessEnv(response: { [string]: mixed }) { | ||
Object.keys(response).forEach((key) => { | ||
Object.keys(response).forEach(key => { | ||
if (key.startsWith('ENV-') && typeof response[key] === 'string') { | ||
@@ -56,5 +56,8 @@ process.env[key.substring(key.indexOf('ENV-') + 4)] = response[key] | ||
function fetchConfigurations(application: string, profiles: Array<string>): Promise<Array<any>> { | ||
const yamlPromises = profiles.map((profile) => getYamlPromise(profile, application)) | ||
return Promise.all(yamlPromises).then((data) => { | ||
function fetchConfigurations( | ||
application: string = configParams.application, | ||
profiles: Array<string> = configParams.profiles | ||
): Promise<Array<any>> { | ||
const yamlPromises = profiles.map(profile => getYamlPromise(profile, application)) | ||
return Promise.all(yamlPromises).then(data => { | ||
return transformYamlResponse(data, profiles) | ||
@@ -61,0 +64,0 @@ }) |
24267
635