Page 1 of 1
Server.Xml file
Posted: Tue Aug 19, 2014 11:35 am
by Gantois
Good morning!
How could I read a variable defined in Server.xml file from within a namespace ?
Example: I have defined <RootData>c:\SiteXData\</RootData> in Server.xml and I have MyUtil.dyalog script file namespace.
From within a “pageABC.dyalog” I get using rootData←req.Server.Config.RootData. How could I get it from within functions/methods defined in MyUtil namespace?
Thanks,
Marco Gantois
Re: Server.Xml file
Posted: Wed Aug 20, 2014 3:31 pm
by Brian|Dyalog
Hi Marco!
You can access the server configuration using #.Boot.ms.Config from anywhere in the workspace, so in your example, you'd use #.Boot.ms.Config.RootData
I hope this helps!
/Brian
Re: Server.Xml file
Posted: Thu Aug 21, 2014 12:09 am
by Gantois
Hi Brian!
Your solution will help me so much but something wrong occurs on #.Boot after the Load command as following:
A) Before Load: that's right
)load mserver
C:\MiServer\mserver saved Thu Apr 18 00:42:52 2013
Start 'Intro' ⍝ Run the demo server
Start 'c:\MeusSites\rcerta' ⍝ Run the demo server
0
MiServer started on port: 8088
#.Boot.ms.Config.RootData
c:\rCerta\
B) After Load:
Load'c:\MeusSites\rcerta'
Development environment loaded
#.Boot.ms.Config.RootData
VALUE ERROR
#.Boot.ms.Config.RootData
C) Another example:
)load mserver
C:\MiServer\mserver saved Thu Apr 18 00:42:52 2013
Start 'Intro' ⍝ Run the demo server
Start 'c:\MeusSites\rcerta' ⍝ Run the demo server
0
MiServer started on port: 8088
#.Restart
Object 'SRV00000000' has been closed - Web Server shutting down
MildServer stopped.
MiServer started on port: 8088
Load'c:\MeusSites\rcerta'
Development environment loaded
#.Restart
VALUE ERROR
Restart[1] approot←Boot.AppRoot
Thanks
Marco
Re: Server.Xml file
Posted: Fri Aug 22, 2014 5:42 am
by Brian|Dyalog
Hi Marco!
Right now, #.Boot.ms.Config is only available while MiServer is running.
Part of the startup of MiServer reads the configuration files and populates the server's configuration.
The Load function just loads the necessary classes so that you can edit pages for your website. Though, it might make some sense to load the configuration as well. I'll consider implementing that for MiServer 3.0.
/Brian
Re: Server.Xml file
Posted: Sat Aug 23, 2014 9:45 am
by Gantois
Hi Brian,
I solved my problem putting RootData variable inside "MyUtil" namespace when I initialized the site variables sessions as following:
#.MyUtil.RootData←req.Server.Config.RootData
req.Session.State.var1←'aaa'
req.Session.State.var2←'bbbbbb'
.....
Thanks
Gantois