Skip to content

Commit 853355e

Browse files
committed
Allow environment variables in config files
1 parent ba53b03 commit 853355e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Core/Boot.dyalog

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,35 @@
246246
:If 0=⍴⍴r rr :EndIf
247247
248248

249+
SubstEnv config;getEnv;subst;n;v
250+
substitute environment variables for items with values im the form $envName$
251+
config is a configuration result from ReadConfiguration
252+
it should be either a namespace reference, or a vector of namespace references
253+
getEnv{2 ⎕NQ'.' 'GetEnvironment'}
254+
subst{
255+
0:
256+
'$'.=(/,/)(2):getEnv 1¯1
257+
}
258+
:Select ⎕NC'config'
259+
:Case 2
260+
:If 9.1.={⎕NC,''}¨config
261+
SubstEnv¨config
262+
:EndIf
263+
:Case 9
264+
:For n :In config.⎕NL ¯2
265+
:Select vconfign
266+
:Case 1
267+
vsubst v
268+
:Case 2
269+
vsubst¨v
270+
:Else
271+
∘∘∘
272+
:EndSelect
273+
'config.',n,'←v'
274+
:EndFor
275+
:EndSelect
276+
277+
249278
config{element}ReadConfiguration type;serverconfig;file;siteconfig;thing;ind;mask
250279
Attempt to read configuration file
251280
1) from server root MSRoot
@@ -278,6 +307,7 @@
278307
configserverconfig
279308
:EndIf
280309
:EndIf
310+
:If config'' SubstEnv config :EndIf
281311
282312

283313
ConfigConfigureServer AppRoot;file

0 commit comments

Comments
 (0)