[leafnode-list] Re: config option: script file

clemens fischer ino-news at spotteswoode.dnsalias.org
Tue Feb 10 01:10:41 CET 2009


clemens fischer wrote:

> since leafnode(8) is growing scripting support in addition to
> fetchnews(8), I think it might be justified to have a configuration
> option defining the location of the script file.  Anytime in the near
> future people will face the same problem as I do:  I have a working lua
> script for spam filtering and archiving in fetchnews(8), and now I need
> to experiment with and test another one for the per-group authorization
> feature.  I would like to continue to run fetchnews with the "stable"
> version, while giving another one to leafnode.
> 
> This means possibly an option in /etc/leafnode/config, but definitely
> a runtime option to all the programs of the leafnode suite.
> 
> Currently, the name of the script file is hardwired in the lua scripting
> code to "/etc/leafnode/scripthooks.lua".  Note that lua is not the only
> scripting backend possible, there is an interface layer called
> "script-redirects.c" allowing future extensions in other languages.
> 
> A clean solution would be a config file option like "script = lua
> /etc/leafnode/scripthooks.lua" or maybe "script-lua = ...", and for the
> runtime, there'd need to be one option to set a language and another one
> to set the corresponding script file.  The best solution would be to
> make the options cummulative, so that people can run scripts in several
> languages.  Currently, the lua scripting can handle only one script
> file, and there's no other language extension, so the minimum solution
> for my immediate problem would be one single option to define that
> filename.
> 
> Looking through the manual pages, I think there are no options "-L" and
> "-l" to any of the leafnode programs, so I'd like to have "-l
> <scriptfile>" with "-L lua" implied.  "-L <language>" should be reserved
> to select the scripting language and "-l <file>" to select the
> associated program text file.

I have implemented a "global" option "-l <scriptfile>".  It is a little
hackish as long as we have just lua-scripting, because we'd have to
distinguish between several possible languages.  This is prepared in the
code, but I have taken a shortcut:  "-l" sets both the scriptfile and
the lua-scriptfile at the same time.

BTW, I just tested the per-group authorization code and it seems to
work.  Maybe Matthias could check it out and release it for testing?

clemens




More information about the leafnode-list mailing list