<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>lighty's life: Weekends Projects: lua as config-language</title>
    <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Weekends Projects: lua as config-language</title>
      <description>&lt;p&gt;With the first implementation of mod_cml and later mod_magnet smart users asked why we don&amp;#8217;t use lua also as config language for lighttpd.&lt;/p&gt;


	&lt;p&gt;Up to now I was pushing back and saying that a huge change in the configfile would make upgraders very unhappy as they would have to rewrite the config files. Looking at what we have for 1.5.0 right now, we need tweaks anyway.&lt;/p&gt;
&lt;p&gt;This always happens if you rip a thing apart: you see more things that should be cleaned up. My first experiments are a bit done:&lt;/p&gt;


&lt;pre&gt;
server = {
        name = "my.example.org",
        modules = {
                "mod_indexfile" 
        },
        ["errorfile-prefix"] = "foobar",
}

sockets = {
        [":80"] = {
                server = { name = "foo.example.org" },
                HTTP = { url = function(url)
                        if url == "foo" then
                                server.name = "baz.example.org" 
                        end
                end },
        }
}

sockets[":80"].HTTP.url("foo")
print(server.name)
&lt;/pre&gt;

	&lt;p&gt;This is a first idea. It shows how the &lt;span class="caps"&gt;LUA&lt;/span&gt; syntax isn&amp;#8217;t sooo different from our current config syntax.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;The global variables, stay global as now.&lt;/li&gt;
		&lt;li&gt;socket conditionals is now a simple array of sockets &lt;/li&gt;
		&lt;li&gt;conditionals are functions, now you can do what you want with it&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;I hope that I can handle the full config syntax into this structure. For now it is looks more appealing that ripping the old config-parser code apart and turn it into glib-notation. With all the conditionals and types we basicly have implemented our own scripting language.&lt;/p&gt;


	&lt;p&gt;Let&amp;#8217;s see where this leads too.&lt;/p&gt;</description>
      <pubDate>Sat, 09 Feb 2008 23:09:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:bfbf72c7-42a9-47c4-a922-27cceb02834f</guid>
      <author>jan</author>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language</link>
      <category>lighttpd</category>
      <trackback:ping>http://blog.lighttpd.net/articles/trackback/4862</trackback:ping>
    </item>
    <item>
      <title>"Weekends Projects: lua as config-language" by Anders</title>
      <description>Yeah, Lua is really nice to use as a configuration parser: it also gives a lot more power to the person who is setting everything up :)</description>
      <pubDate>Thu, 28 Feb 2008 15:14:08 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:08081952-c84d-433e-8514-58f606ddf662</guid>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language#comment-5097</link>
    </item>
    <item>
      <title>"Weekends Projects: lua as config-language" by lu_zero</title>
      <description>Probably would be better benchmark this before choosing such radical change.</description>
      <pubDate>Mon, 25 Feb 2008 08:52:05 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:0b9e6ec6-9fae-4476-a081-6f7af74d1a72</guid>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language#comment-5019</link>
    </item>
    <item>
      <title>"Weekends Projects: lua as config-language" by 1.5</title>
      <description>I uh, thought 1.5 was at the stage where it was about getting rid of regressions, not performing total rewrites.

I was almost in a situation where I'd want to use lighty, then I saw this... no thanks. If there is no control whatsoever over the release process (and this seems to demonstrate that), then it's not going to be a fun ride on board.</description>
      <pubDate>Wed, 20 Feb 2008 21:37:57 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:b48d4489-8528-4985-bdca-f9c1c78f9ddf</guid>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language#comment-4916</link>
    </item>
    <item>
      <title>"Weekends Projects: lua as config-language" by Laph</title>
      <description>Please, no more unusual external dependencies! No LUA-RegExp as long as they differ from PCRE! Current conf-syntax is powerful, easy to learn and work with, if you know PCRE at least a bit - and hey, every Web-Programmer knows PCRE regardless of her/his background (Perl, PHP, Java, MySQL...).</description>
      <pubDate>Tue, 19 Feb 2008 13:27:49 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:52dd02fe-ee03-44f6-8b2d-24e44dc96ca1</guid>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language#comment-4906</link>
    </item>
    <item>
      <title>"Weekends Projects: lua as config-language" by ka2</title>
      <description>ubuntu gutsy's lua is too old for lighttpd 1.5 though :(
Lighttpd says it needs 5.1, gutsy has 5.0</description>
      <pubDate>Tue, 19 Feb 2008 02:51:29 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:b22b38b2-23b6-40f7-92e7-124a90ec107d</guid>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language#comment-4901</link>
    </item>
    <item>
      <title>"Weekends Projects: lua as config-language" by moo</title>
      <description>yeah, it's flexible, but how about the performance? on each request lua gotta go though server = .. things?

and btw, there's some question left not thought yet. like
should it be url.rewrite (...) which is a function call or url.rewrite = (...) which is just a variable.

should it be url.rewrite = ("abc" = "abc" .. var.runtimevariable, "def" = "def" .. var.runtimevariable2 ..............) which is slower
because all variable has to be eval at runtime
or
url.rewrite = ("abc" = "abc%0", "def" = "def%1") which is faster because only one of %0/%1 is only eval if the single rule is matched</description>
      <pubDate>Sat, 16 Feb 2008 16:24:18 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:d190f39a-97e3-4a37-b08b-27e33ce20abe</guid>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language#comment-4895</link>
    </item>
    <item>
      <title>"Weekends Projects: lua as config-language" by Bertrand Mansion</title>
      <description>I love it :)
The more you add lua, the more I like lighty.</description>
      <pubDate>Fri, 15 Feb 2008 15:34:33 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:fa3ee661-ed0a-4ad9-920d-765af9fa0ab7</guid>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language#comment-4885</link>
    </item>
    <item>
      <title>"Weekends Projects: lua as config-language" by Alex Kloss</title>
      <description>That means one could use lua string.match regexp, which on the upside is faster than libpcre yet on the downside will make config file conversion rather difficult on more complex regexp.</description>
      <pubDate>Tue, 12 Feb 2008 08:25:59 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:3317b9c0-0c72-4458-b7d8-2b1cc36b2ac4</guid>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language#comment-4877</link>
    </item>
    <item>
      <title>"Weekends Projects: lua as config-language" by Peter</title>
      <description>Sounds interesting indeed and the comparison of mutant of python and php was the choke of the day ;-)</description>
      <pubDate>Mon, 11 Feb 2008 17:58:04 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:23b1ef6f-0cef-4d06-af38-764f6b20360b</guid>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language#comment-4876</link>
    </item>
    <item>
      <title>"Weekends Projects: lua as config-language" by Keagon</title>
      <description>I would like to see a quick release of 1.5 ... of course, with bugs ironed out and all.</description>
      <pubDate>Mon, 11 Feb 2008 15:47:15 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:649b7df5-ee6e-4f60-8b1a-d4a0af5d5624</guid>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language#comment-4875</link>
    </item>
    <item>
      <title>"Weekends Projects: lua as config-language" by Jan (the other one)</title>
      <description>i like those square brackets. lua looks like a mutant of python and php :) perhaps you can invent a meta conf scheme in XML and a converter for every conf language. then there is no problem in switching the conf as often as you like :)</description>
      <pubDate>Mon, 11 Feb 2008 15:46:40 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:cf0012f3-4725-4c83-939f-54ec6ae84f0c</guid>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language#comment-4874</link>
    </item>
    <item>
      <title>"Weekends Projects: lua as config-language" by Fernando Silva</title>
      <description>Using mod_magnet we (me and a collegue) created a LUA scripting file that implements a virtual hosting mechanism using a LUA file as the database.

Advantages:
1. no need to change the current lighttpd configuration that needs to restart the server
2. no need to use mysql with the obvious performance (and caching problems)
3. much more powerfull than simple vhost, because it allows to do things like automatic 302 redirection
4. so easy to update file to add, remove or change a virtual host

If lighttpd continues to use more LUA, we will be able to implement a good set of modules as LUA extensions, without hitting the server performance.
</description>
      <pubDate>Sun, 10 Feb 2008 14:28:37 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:81a5453a-36c9-43f9-845d-6b3a1e55921d</guid>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language#comment-4869</link>
    </item>
    <item>
      <title>"Weekends Projects: lua as config-language" by anonymouse</title>
      <description>fcicq jokes but I bet it would not be so difficult to create a perl (or ruby) to at least partly convert the configs to newspeak.</description>
      <pubDate>Sun, 10 Feb 2008 14:24:08 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:cb9c431c-b702-4323-ad16-f565fd41fcce</guid>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language#comment-4868</link>
    </item>
    <item>
      <title>"Weekends Projects: lua as config-language" by fcicq</title>
      <description>seems good, we need a lighttpd.conf converter :D -- just kidding</description>
      <pubDate>Sun, 10 Feb 2008 10:31:03 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:5fd7b4ab-d350-45d5-9e47-9d2780f72163</guid>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language#comment-4867</link>
    </item>
    <item>
      <title>"Weekends Projects: lua as config-language" by Viktor</title>
      <description>There are quite a number of levels which could be condensed. I would be prone to more error if i type in a much longer code. I keep mine brief.</description>
      <pubDate>Sun, 10 Feb 2008 08:07:38 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:d0a84628-739f-4c33-9342-af7021517fe5</guid>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language#comment-4866</link>
    </item>
    <item>
      <title>"Weekends Projects: lua as config-language" by Tim</title>
      <description>Sounds interesting.  Though I must admit, I'm simply more interested in a bug free release right now from Lighttp than anything else.</description>
      <pubDate>Sun, 10 Feb 2008 07:13:56 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:7a5cb9a3-3793-4782-94a5-85c6a0aab997</guid>
      <link>http://blog.lighttpd.net/articles/2008/02/09/weekends-projects-lua-as-config-language#comment-4864</link>
    </item>
  </channel>
</rss>
