Server.Xml file

MiServer is Dyalog's APL-based web development framework
Post Reply
Gantois
Posts: 91
Joined: Thu Apr 17, 2014 9:44 am

Server.Xml file

Post 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
User avatar
Brian|Dyalog
Posts: 120
Joined: Thu Nov 26, 2009 4:02 pm
Location: West Henrietta, NY

Re: Server.Xml file

Post 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
Gantois
Posts: 91
Joined: Thu Apr 17, 2014 9:44 am

Re: Server.Xml file

Post 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
User avatar
Brian|Dyalog
Posts: 120
Joined: Thu Nov 26, 2009 4:02 pm
Location: West Henrietta, NY

Re: Server.Xml file

Post 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
Gantois
Posts: 91
Joined: Thu Apr 17, 2014 9:44 am

Re: Server.Xml file

Post 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
Post Reply