initialization

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

initialization

fschmidt
Administrator
I need some kind of initialization in Luan for URL mapping.  I decided to always load "site:/index.html" before serving any pages.  This way this file can do any required initialization.  For example, index.html.luan could contain:
require "site:/private/lib/init"
This will also work in luanhost.  Does this make sense?
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: initialization

Hugo <Nabble>
fschmidt wrote
I decided to always load "site:/index.html" before serving any pages.
If this happens only once (when the very first request arrives) then I think this is acceptable. The problem is that this is not intuitive at all. If people ever browse that code, they will NEVER look at the import and think "hmm, this is how they initialize the site".

I am just wondering if we should have an explict call or if luan should just look for the "init" file in the private/lib folder. If the file is not there, then luan could search for it in the site: folder. The point is that we could have some sample projects and people should have full access to all resources and the init file shouldn't be hidden. This may not be an issue if we can do the import in the site folder like this

import "site:/init.luan"

What do you think? We can discuss this.
Reply | Threaded
Open this post in threaded view
|

Re: initialization

fschmidt
Administrator
Yes, we can discuss this.
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: initialization

Hugo <Nabble>
We discussed this. What you suggested is fine.
Reply | Threaded
Open this post in threaded view
|

Re: initialization

fschmidt
Administrator
closing
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: initialization

fschmidt
Administrator
In reply to this post by Hugo <Nabble>
I am going to use the init.luan approach.  This is needed in case the initialization code wants to tweak index.html.luan .
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: initialization

fschmidt
Administrator
done in luan rev 329 and luanhost rev 51.  closing
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture