Skip to content

Commit

Permalink
Allow environment variables in config files
Browse files Browse the repository at this point in the history
  • Loading branch information
bpbecker committed Apr 6, 2019
1 parent ba53b03 commit 853355e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Core/Boot.dyalog
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,35 @@
:If 0=⍴⍴r rr :EndIf

SubstEnv config;getEnv;subst;n;v
substitute environment variables for items with values im the form $envName$
config is a configuration result from ReadConfiguration
it should be either a namespace reference, or a vector of namespace references
getEnv{2 ⎕NQ'.' 'GetEnvironment'}
subst{
0:
'$'.=(/,/)(2):getEnv 1¯1
}
:Select ⎕NC'config'
:Case 2
:If 9.1.={⎕NC,''}¨config
SubstEnv¨config
:EndIf
:Case 9
:For n :In config.⎕NL ¯2
:Select vconfign
:Case 1
vsubst v
:Case 2
vsubst¨v
:Else
∘∘∘
:EndSelect
'config.',n,'←v'
:EndFor
:EndSelect

config{element}ReadConfiguration type;serverconfig;file;siteconfig;thing;ind;mask
Attempt to read configuration file
1) from server root MSRoot
Expand Down Expand Up @@ -278,6 +307,7 @@
configserverconfig
:EndIf
:EndIf
:If config'' SubstEnv config :EndIf

ConfigConfigureServer AppRoot;file
Expand Down

0 comments on commit 853355e

Please sign in to comment.