Skip to content

Commit

Permalink
Merge pull request #471 from ExpediaDotCom/config_override_fix
Browse files Browse the repository at this point in the history
updating config props prefix to handle other service vars added by k8s
  • Loading branch information
keshavpeswani authored Feb 20, 2019
2 parents 6e3f667 + 917ce89 commit a843ddc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions server/config/override.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ module.exports = {
readOverrides: (collection) => {
const overrideData = {};
_.each(collection, (value, key) => {
if (key.startsWith('HAYSTACK_')) {
if (key.startsWith('HAYSTACK_PROP_')) {
const parts = key.toLowerCase().replace(/__/g, ' ').split('_');
parts.shift();
parts.splice(0, 2);

let configObject = overrideData;
let part = parts.shift();
Expand Down
8 changes: 4 additions & 4 deletions test/server/config/override.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ describe('override configuration reader', () => {

it('iterates over environment variables and returns an object split by _', () => {
const envVariables = {
HAYSTACK_CONNECTORS_TRACES_ENABLED: 'true',
HAYSTACK_CONNECTORS_TRACES_PROVIDER: 'haystack',
HAYSTACK_PROP_CONNECTORS_TRACES_ENABLED: 'true',
HAYSTACK_PROP_CONNECTORS_TRACES_PROVIDER: 'haystack',
TERM: 'xterm-256color'
};

Expand All @@ -51,8 +51,8 @@ describe('override configuration reader', () => {

it('iterates over environment variables and returns an object split by _ and camelCase words split by __', () => {
const envVariables = {
HAYSTACK_CONNECTORS_TRENDS_CONNECTOR__NAME: 'haystack',
HAYSTACK_CONNECTORS_TRENDS_METRIC__TANK__URL: 'http://localhost:6000',
HAYSTACK_PROP_CONNECTORS_TRENDS_CONNECTOR__NAME: 'haystack',
HAYSTACK_PROP_CONNECTORS_TRENDS_METRIC__TANK__URL: 'http://localhost:6000',
TERM: 'xterm-256color'
};

Expand Down

0 comments on commit a843ddc

Please sign in to comment.