g2-ops-config
Advanced tools
Comparing version 0.0.24 to 0.0.25
@@ -30,8 +30,8 @@ 'use strict'; | ||
var configParams = exports.configParams = { | ||
application: process.env.SPRING_APPLICATION_NAME || 'opsportal-dtle-uk', | ||
endpoint: (process.env.CONFIGSERVER_NAME || 'c-config-dev4.copart.com').replace(/http.*:\/\//g, ''), | ||
profiles: process.env.PROFILES ? process.env.PROFILES.split(',') : ['c-dev4', 'kubernetes'], | ||
application: process.env.SPRING_APPLICATION_NAME, | ||
endpoint: process.env.CONFIGSERVER_NAME.replace(/http.*:\/\//g, ''), | ||
profiles: process.env.PROFILES.split(','), | ||
auth: { | ||
user: process.env.CONFIGSERVER_USER || 'user', | ||
pass: process.env.CONFIGSERVER_PASSWORD || 'copart' | ||
user: process.env.CONFIGSERVER_USER, | ||
pass: process.env.CONFIGSERVER_PASSWORD | ||
} | ||
@@ -46,2 +46,6 @@ | ||
var application = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : configParams.application; | ||
if (!configParams.application || !configParams.endpoint || !configParams.profiles) { | ||
throw new Error('process.env[application || endpoint || profiles] are not present'); | ||
} | ||
return 'http://' + configParams.auth.user + ':' + configParams.auth.pass + '@' + configParams.endpoint + '/' + application + '/' + profile; | ||
@@ -48,0 +52,0 @@ }; |
{ | ||
"name": "g2-ops-config", | ||
"version": "0.0.24", | ||
"version": "0.0.25", | ||
"description": "To fetch and maintain cloud configs for difference projects", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -27,3 +27,5 @@ # g2-ops-config | ||
// application.yaml | ||
ENV-SESSION_ID='secret' | ||
ENV: | ||
SESSION_ID = 'secret' | ||
BABEL_ENV = 'development' | ||
``` | ||
@@ -44,2 +46,3 @@ | ||
console.log(process.env.SESSION_ID) // should print 'secret' | ||
console.log(process.env.BABEL_ENV) // should print 'development' | ||
``` | ||
@@ -46,0 +49,0 @@ |
@@ -18,8 +18,8 @@ // @flow | ||
export const configParams: ConfigServerParamsType = { | ||
application: process.env.SPRING_APPLICATION_NAME || 'opsportal-dtle-uk', | ||
endpoint: (process.env.CONFIGSERVER_NAME || 'c-config-dev4.copart.com').replace(/http.*:\/\//g, ''), | ||
profiles: process.env.PROFILES ? process.env.PROFILES.split(',') : ['c-dev4', 'kubernetes'], | ||
application: process.env.SPRING_APPLICATION_NAME, | ||
endpoint: (process.env.CONFIGSERVER_NAME).replace(/http.*:\/\//g, ''), | ||
profiles: process.env.PROFILES.split(','), | ||
auth: { | ||
user: process.env.CONFIGSERVER_USER || 'user', | ||
pass: process.env.CONFIGSERVER_PASSWORD || 'copart', | ||
user: process.env.CONFIGSERVER_USER, | ||
pass: process.env.CONFIGSERVER_PASSWORD, | ||
}, | ||
@@ -33,4 +33,8 @@ } | ||
*/ | ||
export const configFileURL = (profile: string, application?: string = configParams.application): string => | ||
`http://${configParams.auth.user}:${configParams.auth.pass}@${configParams.endpoint}/${application}/${profile}` | ||
export const configFileURL = (profile: string, application?: string = configParams.application): string => { | ||
if (!configParams.application || !configParams.endpoint || !configParams.profiles) { | ||
throw new Error('process.env[application || endpoint || profiles] are not present') | ||
} | ||
return `http://${configParams.auth.user}:${configParams.auth.pass}@${configParams.endpoint}/${application}/${profile}` | ||
} | ||
@@ -37,0 +41,0 @@ function getYamlPromise(profile, application) { |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
290045
17
692
51
13
2