[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-myserver] Configuration?
From: |
Ludovic Courtès |
Subject: |
Re: [bug-myserver] Configuration? |
Date: |
Sat, 05 Mar 2011 12:33:32 +0100 |
User-agent: |
Gnus/5.110013 (No Gnus v0.13) Emacs/23.2 (gnu/linux) |
Hi Giuseppe,
Giuseppe Scrivano <address@hidden> writes:
> actually the myserver.xml file can be empty and the server will use
> default values for the different configurations.
By “empty”, you mean that it contains at least this:
<?xml version="1.0"?>
<MYSERVER>
</MYSERVER>
Right?
I would find even more convenient to not create a file.
> If you also have an empty virtualhosts.xml file, then MyServer will not
> do any listen(2). At least one virtual host must be defined to make
> MyServer wait for new connections.
OK. Could it create a default virtual host automatically when
‘virtualhosts.xml’ isn’t provided?
> To define a new virtual host requires different attributes, some of them
> can be optional and I am not sure how it can be done without introduce
> weird notations.
> Something already present in the TODO list, and I am sure it will excite
> you :-) is the implementation of this feature in the `guile_conf' plugin
> and get at the end something like:
>
> ./myserver --plugins=guile_conf:foo/bar/guile_conf.so \
> --plugin-data="(define vhosts '(("example" "8080" "web" \
> "system" "http")))"
Aaah, I like it. :-)
I’d recommend using disjoint types as much as possible, instead of lists
everywhere. For instance, I’d write the example along the lines of:
(define vhosts
(list (make-virtual-host "example" 'web #:port 8080)))
where ‘make-virtual-host’ is a procedure that returns a ‘virtual-host’
object, with a distinct type. That makes it less error-prone and allows
for better error reporting than when using lists and strings for
everything (anyone who’s used Gnus will understand what this means ;-)).
Disjoint types can be created with SRFI-9, for instance (info "(guile)
SRFI-9").
> Hopefully we will use guile based configuration file as the default
> replacing XML.
Cool. :-)
Perhaps a longer-term goal could be to turn things inside out by making
it possible for Guile code to use MyServer from Guile, like:
#!/usr/bin/guile -s
(use-modules (myserver)) ;; dlopen ‘libmyserver’
;; Configure things.
(define vhosts
(list (make-virtual-host "example" 'web #:port 8080)))
;; Run the web server.
(start-server-loop vhosts)
Another thing that could be interesting is to provide a ‘server-impl’
for Guile’s new web framework (info "(guile) Web Server").
Sorry, I didn’t mean to bother you with these Guile things. ;-)
Thanks,
Ludo’.
- [bug-myserver] Configuration?, Ludovic Courtès, 2011/03/03
- Re: [bug-myserver] Configuration?, Giuseppe Scrivano, 2011/03/03
- Re: [bug-myserver] Configuration?,
Ludovic Courtès <=
- Re: [bug-myserver] Configuration?, Ludovic Courtès, 2011/03/05
- Re: [bug-myserver] Configuration?, Giuseppe Scrivano, 2011/03/08
- Re: [bug-myserver] Configuration?, Giuseppe Scrivano, 2011/03/11
- Re: [bug-myserver] Configuration?, Ludovic Courtès, 2011/03/11
- Re: [bug-myserver] Configuration?, Giuseppe Scrivano, 2011/03/13
- Re: [bug-myserver] Configuration?, Ludovic Courtès, 2011/03/16