Server.Xml file

MiServer is Dyalog's APL-based web development framework

Server.Xml file

Postby Gantois on Tue Aug 19, 2014 11:35 am

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

Re: Server.Xml file

Postby Brian|Dyalog on Wed Aug 20, 2014 3:31 pm

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

Re: Server.Xml file

Postby Gantois on Thu Aug 21, 2014 12:09 am

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

Re: Server.Xml file

Postby Brian|Dyalog on Fri Aug 22, 2014 5:42 am

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

Re: Server.Xml file

Postby Gantois on Sat Aug 23, 2014 9:45 am

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


Return to MiServer

Who is online

Users browsing this forum: No registered users and 1 guest