-
Notifications
You must be signed in to change notification settings - Fork 0
/
InitGlobals.aplf
38 lines (30 loc) · 1.6 KB
/
InitGlobals.aplf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
InitGlobals;env;dir;configfile;cfg;root;config
⍝ Initialise control variables
env←{⍺←'' ⋄ 0=≢r←2 ⎕NQ'.' 'GetEnvironment'⍵:⍺ ⋄ r}
cfg←{⍺←'' ⋄ 0=config.⎕NC ⍵:⍺ ⋄ config⍎⍵}
⍝ From config files
root←⊃⎕NPARTS 4⊃5179⌶⊃⎕SI
configfile←(root,'DevConfig.dcfg') env 'SSGMON_CONFIGFILE'
:If ~⎕NEXISTS configfile
⎕←'Unable to find configuration file "',configfile,'"'
Exit 12
:EndIf
⍝ Originally the variables in the next block were pulled from the config
⍝ namespace which came from the config file, but this doesn't allow
⍝ the use of such as [WORKSPACE]/mydir - so just use env instead
⍝ config←0 ⎕JSON⍠'Dialect' 'JSON5'⊣⊃⎕NGET configfile
DATABASE← 'DevDb' env 'DATABASE'
INTERVAL← '-1' env 'INTERVAL' ⍝ Default: Report all issues
MAILSERVER←'mail.dyalog.com' env 'MAILSERVER'
MAILFROM← '[email protected]' env 'MAILFROM'
MAILTO← '[email protected]' env 'MAILTO'
POLLTYPE← 'both' env 'POLLTYPE' ⍝ Can be 'both', 'mantis' or 'thirdparty'
SSGDEBUG← ⎕JSON '0' env 'DEBUG'
INTERVAL←⍬⍴⊃(//)⎕vfi '¯'@{⍵='-'}⊢INTERVAL ⍝ Possibly ought to do more checking here
⍝ MK and AWS agree that we force the use of MonitorConfig.csv from the code
⍝ directory so that changes can be committed, given us the history.
MONITORCFG←root,'MonitorConfig.csv'
⍝ From environment: DO NOT PUT THESE in config!
SMTPPASS← env 'SMTP_PWD'
MANTISAPITOKEN← env 'MANTIS_TKN'
DATABASE←((~∨/'/\:'∊2↑DATABASE)/root),DATABASE