@everymundo/config-service-client
Advanced tools
Comparing version 1.2.0 to 2.0.0
@@ -12,2 +12,3 @@ 'use strict'; | ||
SPRING_PROFILES_ACTIVE, | ||
SPRING_PROFILES_LABEL, | ||
} = process.env; | ||
@@ -22,5 +23,6 @@ | ||
const configProfiles = SPRING_PROFILES_ACTIVE ? `/${SPRING_PROFILES_ACTIVE}` : ''; | ||
const label = SPRING_PROFILES_LABEL ? `/${SPRING_PROFILES_LABEL}` : '/master'; | ||
const servicePath = `/${getMicroserviceName()}${configProfiles}`; | ||
const servicePath = `/${getMicroserviceName()}${configProfiles}${label}`; | ||
console.debug({servicePath}) | ||
if (!configServiceEndpoint.path.includes(servicePath)) { | ||
@@ -27,0 +29,0 @@ configServiceEndpoint.path = servicePath; |
{ | ||
"name": "@everymundo/config-service-client", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -9,3 +9,3 @@ 'use strict'; | ||
const | ||
cleanrequire = require('@everymundo/cleanrequire'), | ||
cleanrequire = require('@everymundo/cleanrequire'), | ||
{ expect } = require('chai'), | ||
@@ -70,7 +70,7 @@ sinon = require('sinon'), | ||
const res = getEndpoint(); | ||
console.log({ res }) | ||
expect(res).to.have.property('method', 'GET'); | ||
expect(res).to.have.property('path', servicePath); | ||
expect(res).to.have.property('path', `${servicePath}/master`); | ||
expect(res).to.have.property('port', '80'); | ||
expect(res).to.have.property('endpoint', `${baseURL}${servicePath}`); | ||
expect(res).to.have.property('endpoint', `${baseURL}${servicePath}/master`); | ||
// expect(res).to.deep.equal({}); | ||
@@ -81,3 +81,3 @@ }); | ||
context(`when SPRING_CLOUD_CONFIG_URI is defined WITH ${servicePath}`, () => { | ||
const baseURL = `http://someserver.com:80${servicePath}/something-else`; | ||
const baseURL = `http://someserver.com:80${servicePath}/master/something-else`; | ||
@@ -93,3 +93,3 @@ beforeEach(() => { | ||
expect(res).to.have.property('method', 'GET'); | ||
expect(res).to.have.property('path', `${servicePath}/something-else`); | ||
expect(res).to.have.property('path', `${servicePath}/master/something-else`); | ||
expect(res).to.have.property('port', '80'); | ||
@@ -104,6 +104,7 @@ expect(res).to.have.property('endpoint', baseURL); | ||
const configProfiles = 'aws,aws-test,aws-regionName'; | ||
const label = 'master'; | ||
beforeEach(() => { | ||
if (!process.env.SPRING_CLOUD_CONFIG_URI) process.env.SPRING_CLOUD_CONFIG_URI = ''; | ||
if (!process.env.SPRING_PROFILES_ACTIVE) process.env.SPRING_PROFILES_ACTIVE = ''; | ||
if (!process.env.SPRING_PROFILES_ACTIVE) process.env.SPRING_PROFILES_ACTIVE = ''; | ||
@@ -118,5 +119,5 @@ box.stub(process.env, 'SPRING_CLOUD_CONFIG_URI').value(baseURL); | ||
expect(res).to.have.property('method', 'GET'); | ||
expect(res).to.have.property('path', `${servicePath}/${configProfiles}`); | ||
expect(res).to.have.property('path', `${servicePath}/${configProfiles}/${label}`); | ||
expect(res).to.have.property('port', '80'); | ||
expect(res).to.have.property('endpoint', `${baseURL}${servicePath}/${configProfiles}`); | ||
expect(res).to.have.property('endpoint', `${baseURL}${servicePath}/${configProfiles}/${label}`); | ||
// expect(res).to.deep.equal({}); | ||
@@ -129,3 +130,3 @@ }); | ||
const promiseDataToLib = require('@everymundo/promise-data-to'); | ||
const parseConfigLib = require('../lib/parse-config-server-object'); | ||
const parseConfigLib = require('../lib/parse-config-server-object'); | ||
@@ -139,4 +140,4 @@ | ||
box.stub(process.env, 'SPRING_CLOUD_CONFIG_URI').value(baseURL); | ||
box.stub(promiseDataToLib, 'promiseDataTo').callsFake(() => Promise.resolve({resTxt: '{"test": true}'})); | ||
box.stub(parseConfigLib, 'parseConfigServerObject').callsFake(() => ({anotherTest: true})); | ||
box.stub(promiseDataToLib, 'promiseDataTo').callsFake(() => Promise.resolve({ resTxt: '{"test": true}' })); | ||
box.stub(parseConfigLib, 'parseConfigServerObject').callsFake(() => ({ anotherTest: true })); | ||
}); | ||
@@ -149,3 +150,3 @@ | ||
expect(promiseDataToLib.promiseDataTo).to.have.property('calledOnce', true); | ||
expect(config).to.deep.equal({ raw: { test: true }, parsed: { anotherTest: true}}); | ||
expect(config).to.deep.equal({ raw: { test: true }, parsed: { anotherTest: true } }); | ||
}); | ||
@@ -152,0 +153,0 @@ }); |
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
28427
642
1