It was on my wish list for too long and I have finally started to work on it, now MyServer can load its main configuration from a Scheme file, virtual hosts and MIME types are still handled using XML files but works are in progress.
My idea was to implement this feature as a plugin but it couldn’t be handled as a “normal” plugin, as they are loaded after the server configuration is already loaded. As first step I added the possibility to specify as an argument to the myserver executable which plugins must be loaded before read the server configuration:
$ myserver --plugins=guile_conf:path/to/guile_conf.so
At this point I could load the guile_conf plugin and replace the configuration file handler with the Guile version.
I haven’t spend much time to think about a proper way to specify the configuration syntax, this is what we have in XML:
<DEFINE name="server.static_threads" value="10" />
<DEFINE name="http.default_file" foo="bar">
and here how it is translated to Scheme:
(define configuration '(
((name . "http.default_file")
(foo . "bar")
("default.html" "default.htm" "index.html" "index.htm"))
((name . "server.static_threads") "10")
Does it remind you something?
I will probably change its structure, maintain attributes like a cons cells list before the value (or the children nodes) looks a bit tricky. Any suggestion?
The next move will be the support for MIME types and virtual hosts configuration files. Stay tuned!