# HG changeset patch # User jbe # Date 1454631960 -3600 # Node ID 29b1f7a049349b862738024037593897dfb5ae31 # Parent ea84196585359d3f1e2ce10f8ba2adc2ad64569a Updated documentation diff -r ea8419658535 -r 29b1f7a04934 doc/autodoc-header.htmlpart --- a/doc/autodoc-header.htmlpart Wed Jan 20 21:06:07 2016 +0100 +++ b/doc/autodoc-header.htmlpart Fri Feb 05 01:26:00 2016 +0100 @@ -143,6 +143,15 @@

+

+ As a minimum configuration, the used configuration file or pre-fork initializer should at least contain a listen{...} call, e.g.: +

+
+listen{
+  { proto = "tcp", host = "::", port = 8080 },
+  { proto = "tcp", host = "0.0.0.0", port = 8080 }
+}
+execute.inner()  -- if done in pre-fork initializer

Using the atom library

Lua itself has only very few built-in data types. The atom library gives support for extra data types. Currently the following extra data types are provided: @@ -173,14 +182,14 @@ The library “mondelefant” shipping with WebMCP can be used to access PostgreSQL databases. It also serves as an Object-Relational Mapper (ORM). The database connection is usually configured in the config file (e.g. in config/devel.lua):

-config.db = { engine="postgresql", dbname="webmcp_demo" }
-config.db_trace = true
+config.db = { engine="postgresql", dbname="webmcp_demo" }

In addition to configuring the database, it must be opened within a post-fork initializer (e.g. in app/_postfork/01_database.lua):

 _G.db = assert(mondelefant.connect(config.db))
-function mondelefant.class_prototype:get_db_conn() return db end
+function mondelefant.class_prototype:get_db_conn() return db end +execute.inner()

The parameters for mondelefant.connect are directly passed to PostgreSQL's client library libpq. See PostgreSQL's documentation on PQconnect for information about supported parameters.

diff -r ea8419658535 -r 29b1f7a04934 framework/bin/mcp.lua --- a/framework/bin/mcp.lua Wed Jan 20 21:06:07 2016 +0100 +++ b/framework/bin/mcp.lua Fri Feb 05 01:26:00 2016 +0100 @@ -290,10 +290,10 @@ --[[-- listen{ { - proto = proto, -- "local", "tcp4", "tcp6", or "interval" + proto = proto, -- "local", "tcp", or "interval" path = path, -- path to unix domain socket if proto == "local" port = port, -- TCP port number - localhost = localhost_only, -- set to true to only listen on localhost (127.0.0.1 or ::1) interface + host = host, -- "::" for all IPv6 interfaces, "0.0.0.0" for all IPv4 interfaces name = interval_name, -- optional interval name (may be useful for log output) handler = interval_handler -- interval handler if proto == "interval" },