File tree Expand file tree Collapse file tree 2 files changed +52
-1
lines changed
Expand file tree Collapse file tree 2 files changed +52
-1
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,9 @@ export const retrieveConnectionsForDeployment = async (
6565 const connectionRelationships = connections [ i ] . relationships ?? [ ] ;
6666 const contextMap : Object = { } ;
6767 for ( const context of connectionRelationships ) {
68- contextMap [ context . id ] = { ...context . attributes . context } ;
68+ contextMap [ context . id ] = {
69+ ...ContextKeysToUpperCase ( context . attributes . context ) ,
70+ } ;
6971 }
7072
7173 connectionsObjectForFile . CONNECTIONS [
@@ -80,3 +82,16 @@ export const retrieveConnectionsForDeployment = async (
8082 writeFileSync ( universalFilePath , JSON . stringify ( universalConfigFile ) ) ;
8183 return ;
8284} ;
85+
86+ function ContextKeysToUpperCase (
87+ record : Record < string , string > ,
88+ ) : Record < string , string > {
89+ const capitalizedRecord : Record < string , string > = { } ;
90+ for ( const key in record ) {
91+ if ( record . hasOwnProperty ( key ) ) {
92+ const capitalizedKey = key . toUpperCase ( ) ;
93+ capitalizedRecord [ capitalizedKey ] = record [ key ] ;
94+ }
95+ }
96+ return capitalizedRecord ;
97+ }
Original file line number Diff line number Diff line change @@ -41,6 +41,36 @@ const sanitiseConnectionConfigVariables = (
4141 return raw ;
4242} ;
4343
44+ const sanitiseConnectionContextConfigVariables = (
45+ raw ,
46+ variable ,
47+ connections ,
48+ connectionKey ,
49+ ) => {
50+ if ( connections [ connectionKey ] . contexts ) {
51+ const contextKeys = Object . keys ( connections [ connectionKey ] . contexts ) ;
52+ for ( const contextKey of contextKeys ) {
53+ for ( const cfgVar of Object . keys (
54+ connections [ connectionKey ] . contexts [ contextKey ] ,
55+ ) ) {
56+ if ( cfgVar == variable ) {
57+ raw = raw . replace (
58+ new RegExp (
59+ escapeRegExp (
60+ connections [ connectionKey ] . contexts [ contextKey ] [ cfgVar ] ,
61+ ) ,
62+ 'igm' ,
63+ ) ,
64+ '${' + variable + '}' ,
65+ ) ;
66+ }
67+ }
68+ }
69+ }
70+
71+ return raw ;
72+ } ;
73+
4474const sanitisePluginsConfigVariables = ( raw , variable , pluginConfig ) => {
4575 for ( const cfgVar of Object . keys ( pluginConfig ) ) {
4676 if ( cfgVar == variable ) {
@@ -132,6 +162,12 @@ export const sanitise = (raw) => {
132162 config . connections ,
133163 connectionKey ,
134164 ) ;
165+ raw = sanitiseConnectionContextConfigVariables (
166+ raw ,
167+ variable ,
168+ config . connections ,
169+ connectionKey ,
170+ ) ;
135171 }
136172 }
137173 for ( const variable of universalBrokerPluginsVariables ) {
You can’t perform that action at this time.
0 commit comments